@sphereon/ssi-sdk.data-store 0.33.0 → 0.33.1-feature.vcdm2.4

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.
Files changed (210) hide show
  1. package/dist/contact/AbstractContactStore.js +1 -5
  2. package/dist/contact/AbstractContactStore.js.map +1 -1
  3. package/dist/contact/ContactStore.js +544 -545
  4. package/dist/contact/ContactStore.js.map +1 -1
  5. package/dist/digitalCredential/AbstractDigitalCredentialStore.js +1 -5
  6. package/dist/digitalCredential/AbstractDigitalCredentialStore.js.map +1 -1
  7. package/dist/digitalCredential/DigitalCredentialStore.js +131 -142
  8. package/dist/digitalCredential/DigitalCredentialStore.js.map +1 -1
  9. package/dist/entities/contact/BaseConfigEntity.js +13 -14
  10. package/dist/entities/contact/BaseConfigEntity.js.map +1 -1
  11. package/dist/entities/contact/BaseContactEntity.js +24 -22
  12. package/dist/entities/contact/BaseContactEntity.js.map +1 -1
  13. package/dist/entities/contact/ConnectionEntity.js +23 -20
  14. package/dist/entities/contact/ConnectionEntity.js.map +1 -1
  15. package/dist/entities/contact/ContactMetadataItemEntity.js +38 -44
  16. package/dist/entities/contact/ContactMetadataItemEntity.js.map +1 -1
  17. package/dist/entities/contact/CorrelationIdentifierEntity.js +34 -42
  18. package/dist/entities/contact/CorrelationIdentifierEntity.js.map +1 -1
  19. package/dist/entities/contact/DidAuthConfigEntity.js +16 -14
  20. package/dist/entities/contact/DidAuthConfigEntity.js.map +1 -1
  21. package/dist/entities/contact/ElectronicAddressEntity.js +42 -47
  22. package/dist/entities/contact/ElectronicAddressEntity.js.map +1 -1
  23. package/dist/entities/contact/IdentityEntity.js +56 -57
  24. package/dist/entities/contact/IdentityEntity.js.map +1 -1
  25. package/dist/entities/contact/IdentityMetadataItemEntity.js +38 -44
  26. package/dist/entities/contact/IdentityMetadataItemEntity.js.map +1 -1
  27. package/dist/entities/contact/NaturalPersonEntity.js +35 -43
  28. package/dist/entities/contact/NaturalPersonEntity.js.map +1 -1
  29. package/dist/entities/contact/OpenIdConfigEntity.js +24 -18
  30. package/dist/entities/contact/OpenIdConfigEntity.js.map +1 -1
  31. package/dist/entities/contact/OrganizationEntity.js +28 -38
  32. package/dist/entities/contact/OrganizationEntity.js.map +1 -1
  33. package/dist/entities/contact/PartyEntity.js +57 -59
  34. package/dist/entities/contact/PartyEntity.js.map +1 -1
  35. package/dist/entities/contact/PartyRelationshipEntity.js +37 -43
  36. package/dist/entities/contact/PartyRelationshipEntity.js.map +1 -1
  37. package/dist/entities/contact/PartyTypeEntity.js +44 -49
  38. package/dist/entities/contact/PartyTypeEntity.js.map +1 -1
  39. package/dist/entities/contact/PhysicalAddressEntity.js +61 -60
  40. package/dist/entities/contact/PhysicalAddressEntity.js.map +1 -1
  41. package/dist/entities/digitalCredential/DigitalCredentialEntity.js +63 -38
  42. package/dist/entities/digitalCredential/DigitalCredentialEntity.js.map +1 -1
  43. package/dist/entities/eventLogger/AuditEventEntity.js +60 -37
  44. package/dist/entities/eventLogger/AuditEventEntity.js.map +1 -1
  45. package/dist/entities/issuanceBranding/BackgroundAttributesEntity.js +25 -36
  46. package/dist/entities/issuanceBranding/BackgroundAttributesEntity.js.map +1 -1
  47. package/dist/entities/issuanceBranding/BaseLocaleBrandingEntity.js +48 -53
  48. package/dist/entities/issuanceBranding/BaseLocaleBrandingEntity.js.map +1 -1
  49. package/dist/entities/issuanceBranding/CredentialBrandingEntity.js +35 -43
  50. package/dist/entities/issuanceBranding/CredentialBrandingEntity.js.map +1 -1
  51. package/dist/entities/issuanceBranding/CredentialClaimsEntity.js +28 -38
  52. package/dist/entities/issuanceBranding/CredentialClaimsEntity.js.map +1 -1
  53. package/dist/entities/issuanceBranding/CredentialLocaleBrandingEntity.js +18 -18
  54. package/dist/entities/issuanceBranding/CredentialLocaleBrandingEntity.js.map +1 -1
  55. package/dist/entities/issuanceBranding/ImageAttributesEntity.js +34 -42
  56. package/dist/entities/issuanceBranding/ImageAttributesEntity.js.map +1 -1
  57. package/dist/entities/issuanceBranding/ImageDimensionsEntity.js +11 -11
  58. package/dist/entities/issuanceBranding/ImageDimensionsEntity.js.map +1 -1
  59. package/dist/entities/issuanceBranding/IssuerBrandingEntity.js +31 -40
  60. package/dist/entities/issuanceBranding/IssuerBrandingEntity.js.map +1 -1
  61. package/dist/entities/issuanceBranding/IssuerLocaleBrandingEntity.js +27 -24
  62. package/dist/entities/issuanceBranding/IssuerLocaleBrandingEntity.js.map +1 -1
  63. package/dist/entities/issuanceBranding/TextAttributesEntity.js +20 -32
  64. package/dist/entities/issuanceBranding/TextAttributesEntity.js.map +1 -1
  65. package/dist/entities/machineState/MachineStateInfoEntity.js +31 -21
  66. package/dist/entities/machineState/MachineStateInfoEntity.js.map +1 -1
  67. package/dist/entities/oid4vcState/Oid4vcStateEntity.js +24 -18
  68. package/dist/entities/oid4vcState/Oid4vcStateEntity.js.map +1 -1
  69. package/dist/entities/presentationDefinition/PresentationDefinitionItemEntity.js +34 -27
  70. package/dist/entities/presentationDefinition/PresentationDefinitionItemEntity.js.map +1 -1
  71. package/dist/entities/statusList/StatusList2021EntryEntity.js +26 -22
  72. package/dist/entities/statusList/StatusList2021EntryEntity.js.map +1 -1
  73. package/dist/entities/statusList/StatusListEntities.js +48 -39
  74. package/dist/entities/statusList/StatusListEntities.js.map +1 -1
  75. package/dist/entities/validators/index.js +6 -10
  76. package/dist/entities/validators/index.js.map +1 -1
  77. package/dist/eventLogger/AbstractEventLoggerStore.js +1 -5
  78. package/dist/eventLogger/AbstractEventLoggerStore.js.map +1 -1
  79. package/dist/eventLogger/EventLoggerStore.js +50 -65
  80. package/dist/eventLogger/EventLoggerStore.js.map +1 -1
  81. package/dist/index.js +96 -163
  82. package/dist/index.js.map +1 -1
  83. package/dist/issuanceBranding/AbstractIssuanceBrandingStore.js +1 -5
  84. package/dist/issuanceBranding/AbstractIssuanceBrandingStore.js.map +1 -1
  85. package/dist/issuanceBranding/IssuanceBrandingStore.js +331 -333
  86. package/dist/issuanceBranding/IssuanceBrandingStore.js.map +1 -1
  87. package/dist/machineState/IAbstractMachineStateStore.js +1 -5
  88. package/dist/machineState/IAbstractMachineStateStore.js.map +1 -1
  89. package/dist/machineState/MachineStateStore.js +102 -122
  90. package/dist/machineState/MachineStateStore.js.map +1 -1
  91. package/dist/migrations/generic/1-CreateContacts.js +50 -72
  92. package/dist/migrations/generic/1-CreateContacts.js.map +1 -1
  93. package/dist/migrations/generic/10-CreatePresentationDefinitions.js +50 -72
  94. package/dist/migrations/generic/10-CreatePresentationDefinitions.js.map +1 -1
  95. package/dist/migrations/generic/11-FixCredentialClaimsReferenceUuid.js +52 -74
  96. package/dist/migrations/generic/11-FixCredentialClaimsReferenceUuid.js.map +1 -1
  97. package/dist/migrations/generic/2-CreateIssuanceBranding.js +50 -72
  98. package/dist/migrations/generic/2-CreateIssuanceBranding.js.map +1 -1
  99. package/dist/migrations/generic/3-CreateContacts.js +50 -72
  100. package/dist/migrations/generic/3-CreateContacts.js.map +1 -1
  101. package/dist/migrations/generic/4-CreateStatusList.js +56 -78
  102. package/dist/migrations/generic/4-CreateStatusList.js.map +1 -1
  103. package/dist/migrations/generic/5-CreateAuditEvents.js +50 -72
  104. package/dist/migrations/generic/5-CreateAuditEvents.js.map +1 -1
  105. package/dist/migrations/generic/6-CreateDigitalCredential.js +50 -72
  106. package/dist/migrations/generic/6-CreateDigitalCredential.js.map +1 -1
  107. package/dist/migrations/generic/7-CreateMachineStateStore.js +50 -72
  108. package/dist/migrations/generic/7-CreateMachineStateStore.js.map +1 -1
  109. package/dist/migrations/generic/8-CreateContacts.js +50 -72
  110. package/dist/migrations/generic/8-CreateContacts.js.map +1 -1
  111. package/dist/migrations/generic/9-CreateContacts.js +50 -72
  112. package/dist/migrations/generic/9-CreateContacts.js.map +1 -1
  113. package/dist/migrations/generic/index.js +30 -33
  114. package/dist/migrations/generic/index.js.map +1 -1
  115. package/dist/migrations/index.js +1 -12
  116. package/dist/migrations/index.js.map +1 -1
  117. package/dist/migrations/internal-migrations-ormconfig.js +6 -8
  118. package/dist/migrations/internal-migrations-ormconfig.js.map +1 -1
  119. package/dist/migrations/postgres/1659463079428-CreateContacts.js +34 -53
  120. package/dist/migrations/postgres/1659463079428-CreateContacts.js.map +1 -1
  121. package/dist/migrations/postgres/1685628974232-CreateIssuanceBranding.js +50 -69
  122. package/dist/migrations/postgres/1685628974232-CreateIssuanceBranding.js.map +1 -1
  123. package/dist/migrations/postgres/1690925872592-CreateContacts.js +87 -106
  124. package/dist/migrations/postgres/1690925872592-CreateContacts.js.map +1 -1
  125. package/dist/migrations/postgres/1693866470001-CreateStatusList.js +16 -35
  126. package/dist/migrations/postgres/1693866470001-CreateStatusList.js.map +1 -1
  127. package/dist/migrations/postgres/1701634812183-CreateAuditEvents.js +22 -41
  128. package/dist/migrations/postgres/1701634812183-CreateAuditEvents.js.map +1 -1
  129. package/dist/migrations/postgres/1708525189001-CreateDigitalCredential.js +19 -38
  130. package/dist/migrations/postgres/1708525189001-CreateDigitalCredential.js.map +1 -1
  131. package/dist/migrations/postgres/1708797018115-CreateMachineStateStore.js +6 -25
  132. package/dist/migrations/postgres/1708797018115-CreateMachineStateStore.js.map +1 -1
  133. package/dist/migrations/postgres/1710438363001-CreateContacts.js +40 -59
  134. package/dist/migrations/postgres/1710438363001-CreateContacts.js.map +1 -1
  135. package/dist/migrations/postgres/1715761125001-CreateContacts.js +18 -37
  136. package/dist/migrations/postgres/1715761125001-CreateContacts.js.map +1 -1
  137. package/dist/migrations/postgres/1716475165345-CreatePresentationDefinitions.js +6 -25
  138. package/dist/migrations/postgres/1716475165345-CreatePresentationDefinitions.js.map +1 -1
  139. package/dist/migrations/postgres/1737110469001-UpdateStatusList.js +16 -35
  140. package/dist/migrations/postgres/1737110469001-UpdateStatusList.js.map +1 -1
  141. package/dist/migrations/postgres/1741895822987-FixCredentialClaimsReferencesUuid.js +8 -27
  142. package/dist/migrations/postgres/1741895822987-FixCredentialClaimsReferencesUuid.js.map +1 -1
  143. package/dist/migrations/sqlite/1659463069549-CreateContacts.js +56 -75
  144. package/dist/migrations/sqlite/1659463069549-CreateContacts.js.map +1 -1
  145. package/dist/migrations/sqlite/1685628973231-CreateIssuanceBranding.js +70 -89
  146. package/dist/migrations/sqlite/1685628973231-CreateIssuanceBranding.js.map +1 -1
  147. package/dist/migrations/sqlite/1690925872693-CreateContacts.js +120 -139
  148. package/dist/migrations/sqlite/1690925872693-CreateContacts.js.map +1 -1
  149. package/dist/migrations/sqlite/1693866470000-CreateStatusList.js +12 -31
  150. package/dist/migrations/sqlite/1693866470000-CreateStatusList.js.map +1 -1
  151. package/dist/migrations/sqlite/1701634819487-CreateAuditEvents.js +6 -25
  152. package/dist/migrations/sqlite/1701634819487-CreateAuditEvents.js.map +1 -1
  153. package/dist/migrations/sqlite/1708525189002-CreateDigitalCredential.js +7 -26
  154. package/dist/migrations/sqlite/1708525189002-CreateDigitalCredential.js.map +1 -1
  155. package/dist/migrations/sqlite/1708796002272-CreateMachineStateStore.js +6 -25
  156. package/dist/migrations/sqlite/1708796002272-CreateMachineStateStore.js.map +1 -1
  157. package/dist/migrations/sqlite/1710438363002-CreateContacts.js +43 -62
  158. package/dist/migrations/sqlite/1710438363002-CreateContacts.js.map +1 -1
  159. package/dist/migrations/sqlite/1715761125002-CreateContacts.js +18 -37
  160. package/dist/migrations/sqlite/1715761125002-CreateContacts.js.map +1 -1
  161. package/dist/migrations/sqlite/1716475165344-CreatePresentationDefinitions.js +6 -25
  162. package/dist/migrations/sqlite/1716475165344-CreatePresentationDefinitions.js.map +1 -1
  163. package/dist/migrations/sqlite/1737110469000-UpdateStatusList.js +20 -39
  164. package/dist/migrations/sqlite/1737110469000-UpdateStatusList.js.map +1 -1
  165. package/dist/migrations/sqlite/1741895822987-FixCredentialClaimsReferencesUuid.js +25 -44
  166. package/dist/migrations/sqlite/1741895822987-FixCredentialClaimsReferencesUuid.js.map +1 -1
  167. package/dist/presentationDefinition/AbstractPDStore.js +1 -5
  168. package/dist/presentationDefinition/AbstractPDStore.js.map +1 -1
  169. package/dist/presentationDefinition/PDStore.js +114 -123
  170. package/dist/presentationDefinition/PDStore.js.map +1 -1
  171. package/dist/statusList/IStatusListStore.js +1 -2
  172. package/dist/statusList/StatusListStore.js +196 -225
  173. package/dist/statusList/StatusListStore.js.map +1 -1
  174. package/dist/types/contact/IAbstractContactStore.js +1 -2
  175. package/dist/types/contact/contact.js +10 -13
  176. package/dist/types/contact/contact.js.map +1 -1
  177. package/dist/types/digitalCredential/IAbstractDigitalCredentialStore.js +1 -2
  178. package/dist/types/digitalCredential/digitalCredential.js +13 -16
  179. package/dist/types/digitalCredential/digitalCredential.js.map +1 -1
  180. package/dist/types/eventLogger/IAbstractEventLoggerStore.js +1 -2
  181. package/dist/types/eventLogger/eventLogger.js +1 -2
  182. package/dist/types/index.js +14 -30
  183. package/dist/types/index.js.map +1 -1
  184. package/dist/types/issuanceBranding/IAbstractIssuanceBrandingStore.js +1 -2
  185. package/dist/types/issuanceBranding/issuanceBranding.js +1 -2
  186. package/dist/types/machineState/IAbstractMachineStateStore.js +1 -2
  187. package/dist/types/presentationDefinition/IAbstractPDStore.js +1 -2
  188. package/dist/types/presentationDefinition/presentationDefinition.js +1 -2
  189. package/dist/types/statusList/IAbstractStatusListStore.js +1 -2
  190. package/dist/types/statusList/statusList.js +1 -2
  191. package/dist/types/validation/validation.js +1 -2
  192. package/dist/utils/FormattingUtils.js +3 -7
  193. package/dist/utils/FormattingUtils.js.map +1 -1
  194. package/dist/utils/SortingUtils.js +1 -5
  195. package/dist/utils/SortingUtils.js.map +1 -1
  196. package/dist/utils/ValidatorUtils.js +2 -6
  197. package/dist/utils/ValidatorUtils.js.map +1 -1
  198. package/dist/utils/contact/MappingUtils.js +124 -150
  199. package/dist/utils/contact/MappingUtils.js.map +1 -1
  200. package/dist/utils/digitalCredential/MappingUtils.js +50 -47
  201. package/dist/utils/digitalCredential/MappingUtils.js.map +1 -1
  202. package/dist/utils/eventLogger/MappingUtils.js +60 -22
  203. package/dist/utils/eventLogger/MappingUtils.js.map +1 -1
  204. package/dist/utils/issuanceBranding/MappingUtils.js +71 -77
  205. package/dist/utils/issuanceBranding/MappingUtils.js.map +1 -1
  206. package/dist/utils/presentationDefinition/MappingUtils.js +9 -15
  207. package/dist/utils/presentationDefinition/MappingUtils.js.map +1 -1
  208. package/dist/utils/statusList/MappingUtils.js +27 -22
  209. package/dist/utils/statusList/MappingUtils.js.map +1 -1
  210. package/package.json +5 -5
@@ -1,73 +1,54 @@
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.CreateIssuanceBranding1685628974232 = void 0;
13
- const ssi_sdk_core_1 = require("@sphereon/ssi-sdk.core");
14
- class CreateIssuanceBranding1685628974232 {
15
- constructor() {
16
- this.name = 'CreateIssuanceBranding1685628974232';
1
+ import { enablePostgresUuidExtension } from '@sphereon/ssi-sdk.core';
2
+ export class CreateIssuanceBranding1685628974232 {
3
+ name = 'CreateIssuanceBranding1685628974232';
4
+ async up(queryRunner) {
5
+ await enablePostgresUuidExtension(queryRunner);
6
+ await queryRunner.query(`CREATE TABLE "ImageDimensions" ("id" uuid NOT NULL DEFAULT uuid_generate_v4(), "width" integer NOT NULL, "height" integer NOT NULL, CONSTRAINT "PK_ImageDimensions_id" PRIMARY KEY ("id"))`);
7
+ await queryRunner.query(`CREATE TABLE "ImageAttributes" ("id" uuid NOT NULL DEFAULT uuid_generate_v4(), "uri" character varying, "dataUri" character varying, "mediaType" character varying(255), "alt" character varying(255), "dimensionsId" uuid, CONSTRAINT "UQ_dimensionsId" UNIQUE ("dimensionsId"), CONSTRAINT "PK_ImageAttributes_id" PRIMARY KEY ("id"))`);
8
+ await queryRunner.query(`CREATE TABLE "BackgroundAttributes" ("id" uuid NOT NULL DEFAULT uuid_generate_v4(), "color" character varying(255), "imageId" uuid, CONSTRAINT "UQ_imageId" UNIQUE ("imageId"), CONSTRAINT "PK_BackgroundAttributes_id" PRIMARY KEY ("id"))`);
9
+ await queryRunner.query(`CREATE TABLE "TextAttributes" ("id" uuid NOT NULL DEFAULT uuid_generate_v4(), "color" character varying(255), CONSTRAINT "PK_TextAttributes_id" PRIMARY KEY ("id"))`);
10
+ await queryRunner.query(`CREATE TABLE "BaseLocaleBranding" ("id" uuid NOT NULL DEFAULT uuid_generate_v4(), "alias" character varying(255), "locale" character varying(255) NOT NULL, "description" character varying(255), "created_at" TIMESTAMP NOT NULL DEFAULT now(), "last_updated_at" TIMESTAMP NOT NULL DEFAULT now(), "credentialBrandingId" uuid, "issuerBrandingId" uuid, "type" character varying NOT NULL, "logoId" uuid, "backgroundId" uuid, "textId" uuid, "client_uri" character varying, "tos_uri" character varying, "policy_uri" character varying, "contacts" character varying, CONSTRAINT "UQ_logoId" UNIQUE ("logoId"), CONSTRAINT "UQ_backgroundId" UNIQUE ("backgroundId"), CONSTRAINT "UQ_textId" UNIQUE ("textId"), CONSTRAINT "PK_BaseLocaleBranding_id" PRIMARY KEY ("id"))`);
11
+ await queryRunner.query(`CREATE UNIQUE INDEX "IDX_CredentialLocaleBrandingEntity_credentialBranding_locale" ON "BaseLocaleBranding" ("credentialBrandingId", "locale")`);
12
+ await queryRunner.query(`CREATE UNIQUE INDEX "IDX_IssuerLocaleBrandingEntity_issuerBranding_locale" ON "BaseLocaleBranding" ("issuerBrandingId", "locale")`);
13
+ await queryRunner.query(`CREATE INDEX "IDX_BaseLocaleBranding_type" ON "BaseLocaleBranding" ("type")`);
14
+ await queryRunner.query(`CREATE TABLE "CredentialClaims" ("id" uuid NOT NULL DEFAULT uuid_generate_v4(), "key" character varying(255) NOT NULL, "name" character varying(255) NOT NULL, "credentialLocaleBrandingId" character varying, CONSTRAINT "PK_CredentialClaims_id" PRIMARY KEY ("id"))`);
15
+ await queryRunner.query(`CREATE UNIQUE INDEX "IDX_CredentialClaimsEntity_credentialLocaleBranding_locale" ON "CredentialClaims" ("credentialLocaleBrandingId", "key")`);
16
+ await queryRunner.query(`CREATE TABLE "CredentialBranding" ("id" uuid NOT NULL DEFAULT uuid_generate_v4(), "vcHash" character varying(255) NOT NULL, "issuerCorrelationId" character varying(255) NOT NULL, "created_at" TIMESTAMP NOT NULL DEFAULT now(), "last_updated_at" TIMESTAMP NOT NULL DEFAULT now(), CONSTRAINT "UQ_vcHash" UNIQUE ("vcHash"), CONSTRAINT "PK_CredentialBranding_id" PRIMARY KEY ("id"))`);
17
+ await queryRunner.query(`CREATE INDEX "IDX_CredentialBrandingEntity_issuerCorrelationId" ON "CredentialBranding" ("issuerCorrelationId")`);
18
+ await queryRunner.query(`CREATE INDEX "IDX_CredentialBrandingEntity_vcHash" ON "CredentialBranding" ("vcHash")`);
19
+ await queryRunner.query(`CREATE TABLE "IssuerBranding" ("id" uuid NOT NULL DEFAULT uuid_generate_v4(), "issuerCorrelationId" character varying(255) NOT NULL, "created_at" TIMESTAMP NOT NULL DEFAULT now(), "last_updated_at" TIMESTAMP NOT NULL DEFAULT now(), CONSTRAINT "UQ_issuerCorrelationId" UNIQUE ("issuerCorrelationId"), CONSTRAINT "PK_IssuerBranding_id" PRIMARY KEY ("id"))`);
20
+ await queryRunner.query(`CREATE INDEX "IDX_IssuerBrandingEntity_issuerCorrelationId" ON "IssuerBranding" ("issuerCorrelationId")`);
21
+ await queryRunner.query(`ALTER TABLE "ImageAttributes" ADD CONSTRAINT "FK_ImageAttributes_dimensionsId" FOREIGN KEY ("dimensionsId") REFERENCES "ImageDimensions"("id") ON DELETE CASCADE ON UPDATE NO ACTION`);
22
+ await queryRunner.query(`ALTER TABLE "BackgroundAttributes" ADD CONSTRAINT "FK_BackgroundAttributes_imageId" FOREIGN KEY ("imageId") REFERENCES "ImageAttributes"("id") ON DELETE CASCADE ON UPDATE NO ACTION`);
23
+ await queryRunner.query(`ALTER TABLE "BaseLocaleBranding" ADD CONSTRAINT "FK_BaseLocaleBranding_logoId" FOREIGN KEY ("logoId") REFERENCES "ImageAttributes"("id") ON DELETE CASCADE ON UPDATE NO ACTION`);
24
+ await queryRunner.query(`ALTER TABLE "BaseLocaleBranding" ADD CONSTRAINT "FK_BaseLocaleBranding_backgroundId" FOREIGN KEY ("backgroundId") REFERENCES "BackgroundAttributes"("id") ON DELETE CASCADE ON UPDATE NO ACTION`);
25
+ await queryRunner.query(`ALTER TABLE "BaseLocaleBranding" ADD CONSTRAINT "FK_BaseLocaleBranding_textId" FOREIGN KEY ("textId") REFERENCES "TextAttributes"("id") ON DELETE CASCADE ON UPDATE NO ACTION`);
26
+ await queryRunner.query(`ALTER TABLE "BaseLocaleBranding" ADD CONSTRAINT "FK_BaseLocaleBranding_credentialBrandingId" FOREIGN KEY ("credentialBrandingId") REFERENCES "CredentialBranding"("id") ON DELETE CASCADE ON UPDATE NO ACTION`);
27
+ await queryRunner.query(`ALTER TABLE "BaseLocaleBranding" ADD CONSTRAINT "FK_BaseLocaleBranding_issuerBrandingId" FOREIGN KEY ("issuerBrandingId") REFERENCES "IssuerBranding"("id") ON DELETE CASCADE ON UPDATE NO ACTION`);
17
28
  }
18
- up(queryRunner) {
19
- return __awaiter(this, void 0, void 0, function* () {
20
- yield (0, ssi_sdk_core_1.enablePostgresUuidExtension)(queryRunner);
21
- yield queryRunner.query(`CREATE TABLE "ImageDimensions" ("id" uuid NOT NULL DEFAULT uuid_generate_v4(), "width" integer NOT NULL, "height" integer NOT NULL, CONSTRAINT "PK_ImageDimensions_id" PRIMARY KEY ("id"))`);
22
- yield queryRunner.query(`CREATE TABLE "ImageAttributes" ("id" uuid NOT NULL DEFAULT uuid_generate_v4(), "uri" character varying, "dataUri" character varying, "mediaType" character varying(255), "alt" character varying(255), "dimensionsId" uuid, CONSTRAINT "UQ_dimensionsId" UNIQUE ("dimensionsId"), CONSTRAINT "PK_ImageAttributes_id" PRIMARY KEY ("id"))`);
23
- yield queryRunner.query(`CREATE TABLE "BackgroundAttributes" ("id" uuid NOT NULL DEFAULT uuid_generate_v4(), "color" character varying(255), "imageId" uuid, CONSTRAINT "UQ_imageId" UNIQUE ("imageId"), CONSTRAINT "PK_BackgroundAttributes_id" PRIMARY KEY ("id"))`);
24
- yield queryRunner.query(`CREATE TABLE "TextAttributes" ("id" uuid NOT NULL DEFAULT uuid_generate_v4(), "color" character varying(255), CONSTRAINT "PK_TextAttributes_id" PRIMARY KEY ("id"))`);
25
- yield queryRunner.query(`CREATE TABLE "BaseLocaleBranding" ("id" uuid NOT NULL DEFAULT uuid_generate_v4(), "alias" character varying(255), "locale" character varying(255) NOT NULL, "description" character varying(255), "created_at" TIMESTAMP NOT NULL DEFAULT now(), "last_updated_at" TIMESTAMP NOT NULL DEFAULT now(), "credentialBrandingId" uuid, "issuerBrandingId" uuid, "type" character varying NOT NULL, "logoId" uuid, "backgroundId" uuid, "textId" uuid, "client_uri" character varying, "tos_uri" character varying, "policy_uri" character varying, "contacts" character varying, CONSTRAINT "UQ_logoId" UNIQUE ("logoId"), CONSTRAINT "UQ_backgroundId" UNIQUE ("backgroundId"), CONSTRAINT "UQ_textId" UNIQUE ("textId"), CONSTRAINT "PK_BaseLocaleBranding_id" PRIMARY KEY ("id"))`);
26
- yield queryRunner.query(`CREATE UNIQUE INDEX "IDX_CredentialLocaleBrandingEntity_credentialBranding_locale" ON "BaseLocaleBranding" ("credentialBrandingId", "locale")`);
27
- yield queryRunner.query(`CREATE UNIQUE INDEX "IDX_IssuerLocaleBrandingEntity_issuerBranding_locale" ON "BaseLocaleBranding" ("issuerBrandingId", "locale")`);
28
- yield queryRunner.query(`CREATE INDEX "IDX_BaseLocaleBranding_type" ON "BaseLocaleBranding" ("type")`);
29
- yield queryRunner.query(`CREATE TABLE "CredentialClaims" ("id" uuid NOT NULL DEFAULT uuid_generate_v4(), "key" character varying(255) NOT NULL, "name" character varying(255) NOT NULL, "credentialLocaleBrandingId" character varying, CONSTRAINT "PK_CredentialClaims_id" PRIMARY KEY ("id"))`);
30
- yield queryRunner.query(`CREATE UNIQUE INDEX "IDX_CredentialClaimsEntity_credentialLocaleBranding_locale" ON "CredentialClaims" ("credentialLocaleBrandingId", "key")`);
31
- yield queryRunner.query(`CREATE TABLE "CredentialBranding" ("id" uuid NOT NULL DEFAULT uuid_generate_v4(), "vcHash" character varying(255) NOT NULL, "issuerCorrelationId" character varying(255) NOT NULL, "created_at" TIMESTAMP NOT NULL DEFAULT now(), "last_updated_at" TIMESTAMP NOT NULL DEFAULT now(), CONSTRAINT "UQ_vcHash" UNIQUE ("vcHash"), CONSTRAINT "PK_CredentialBranding_id" PRIMARY KEY ("id"))`);
32
- yield queryRunner.query(`CREATE INDEX "IDX_CredentialBrandingEntity_issuerCorrelationId" ON "CredentialBranding" ("issuerCorrelationId")`);
33
- yield queryRunner.query(`CREATE INDEX "IDX_CredentialBrandingEntity_vcHash" ON "CredentialBranding" ("vcHash")`);
34
- yield queryRunner.query(`CREATE TABLE "IssuerBranding" ("id" uuid NOT NULL DEFAULT uuid_generate_v4(), "issuerCorrelationId" character varying(255) NOT NULL, "created_at" TIMESTAMP NOT NULL DEFAULT now(), "last_updated_at" TIMESTAMP NOT NULL DEFAULT now(), CONSTRAINT "UQ_issuerCorrelationId" UNIQUE ("issuerCorrelationId"), CONSTRAINT "PK_IssuerBranding_id" PRIMARY KEY ("id"))`);
35
- yield queryRunner.query(`CREATE INDEX "IDX_IssuerBrandingEntity_issuerCorrelationId" ON "IssuerBranding" ("issuerCorrelationId")`);
36
- yield queryRunner.query(`ALTER TABLE "ImageAttributes" ADD CONSTRAINT "FK_ImageAttributes_dimensionsId" FOREIGN KEY ("dimensionsId") REFERENCES "ImageDimensions"("id") ON DELETE CASCADE ON UPDATE NO ACTION`);
37
- yield queryRunner.query(`ALTER TABLE "BackgroundAttributes" ADD CONSTRAINT "FK_BackgroundAttributes_imageId" FOREIGN KEY ("imageId") REFERENCES "ImageAttributes"("id") ON DELETE CASCADE ON UPDATE NO ACTION`);
38
- yield queryRunner.query(`ALTER TABLE "BaseLocaleBranding" ADD CONSTRAINT "FK_BaseLocaleBranding_logoId" FOREIGN KEY ("logoId") REFERENCES "ImageAttributes"("id") ON DELETE CASCADE ON UPDATE NO ACTION`);
39
- yield queryRunner.query(`ALTER TABLE "BaseLocaleBranding" ADD CONSTRAINT "FK_BaseLocaleBranding_backgroundId" FOREIGN KEY ("backgroundId") REFERENCES "BackgroundAttributes"("id") ON DELETE CASCADE ON UPDATE NO ACTION`);
40
- yield queryRunner.query(`ALTER TABLE "BaseLocaleBranding" ADD CONSTRAINT "FK_BaseLocaleBranding_textId" FOREIGN KEY ("textId") REFERENCES "TextAttributes"("id") ON DELETE CASCADE ON UPDATE NO ACTION`);
41
- yield queryRunner.query(`ALTER TABLE "BaseLocaleBranding" ADD CONSTRAINT "FK_BaseLocaleBranding_credentialBrandingId" FOREIGN KEY ("credentialBrandingId") REFERENCES "CredentialBranding"("id") ON DELETE CASCADE ON UPDATE NO ACTION`);
42
- yield queryRunner.query(`ALTER TABLE "BaseLocaleBranding" ADD CONSTRAINT "FK_BaseLocaleBranding_issuerBrandingId" FOREIGN KEY ("issuerBrandingId") REFERENCES "IssuerBranding"("id") ON DELETE CASCADE ON UPDATE NO ACTION`);
43
- });
44
- }
45
- down(queryRunner) {
46
- return __awaiter(this, void 0, void 0, function* () {
47
- yield queryRunner.query(`ALTER TABLE "BaseLocaleBranding" DROP CONSTRAINT "FK_BaseLocaleBranding_issuerBrandingId"`);
48
- yield queryRunner.query(`ALTER TABLE "BaseLocaleBranding" DROP CONSTRAINT "FK_BaseLocaleBranding_credentialBrandingId"`);
49
- yield queryRunner.query(`ALTER TABLE "BaseLocaleBranding" DROP CONSTRAINT "FK_BaseLocaleBranding_textId"`);
50
- yield queryRunner.query(`ALTER TABLE "BaseLocaleBranding" DROP CONSTRAINT "FK_BaseLocaleBranding_backgroundId"`);
51
- yield queryRunner.query(`ALTER TABLE "BaseLocaleBranding" DROP CONSTRAINT "FK_BaseLocaleBranding_logoId"`);
52
- yield queryRunner.query(`ALTER TABLE "BaseLocaleBranding" DROP CONSTRAINT "FK_BackgroundAttributes_imageId"`);
53
- yield queryRunner.query(`ALTER TABLE "BaseLocaleBranding" DROP CONSTRAINT "FK_ImageAttributes_dimensionsId"`);
54
- yield queryRunner.query(`ALTER TABLE "IssuerBranding" DROP INDEX "IDX_IssuerBrandingEntity_issuerCorrelationId"`);
55
- yield queryRunner.query(`DROP TABLE "IssuerBranding"`);
56
- yield queryRunner.query(`ALTER TABLE "CredentialBranding" DROP INDEX "IDX_CredentialBrandingEntity_vcHash"`);
57
- yield queryRunner.query(`ALTER TABLE "CredentialBranding" DROP INDEX "IDX_CredentialBrandingEntity_issuerCorrelationId"`);
58
- yield queryRunner.query(`DROP TABLE "CredentialBranding"`);
59
- yield queryRunner.query(`ALTER TABLE "BaseLocaleBranding" DROP INDEX "IDX_BaseLocaleBranding_type"`);
60
- yield queryRunner.query(`ALTER TABLE "BaseLocaleBranding" DROP INDEX "IDX_IssuerLocaleBrandingEntity_issuerBranding_locale"`);
61
- yield queryRunner.query(`ALTER TABLE "BaseLocaleBranding" DROP INDEX "IDX_CredentialLocaleBrandingEntity_credentialBranding_locale"`);
62
- yield queryRunner.query(`ALTER TABLE "CredentialClaims" DROP INDEX "IDX_CredentialClaimsEntity_credentialLocaleBranding_locale"`);
63
- yield queryRunner.query(`DROP TABLE "CredentialClaims"`);
64
- yield queryRunner.query(`DROP TABLE "BaseLocaleBranding"`);
65
- yield queryRunner.query(`DROP TABLE "TextAttributes"`);
66
- yield queryRunner.query(`DROP TABLE "BackgroundAttributes"`);
67
- yield queryRunner.query(`DROP TABLE "ImageAttributes"`);
68
- yield queryRunner.query(`DROP TABLE "ImageDimensions"`);
69
- });
29
+ async down(queryRunner) {
30
+ await queryRunner.query(`ALTER TABLE "BaseLocaleBranding" DROP CONSTRAINT "FK_BaseLocaleBranding_issuerBrandingId"`);
31
+ await queryRunner.query(`ALTER TABLE "BaseLocaleBranding" DROP CONSTRAINT "FK_BaseLocaleBranding_credentialBrandingId"`);
32
+ await queryRunner.query(`ALTER TABLE "BaseLocaleBranding" DROP CONSTRAINT "FK_BaseLocaleBranding_textId"`);
33
+ await queryRunner.query(`ALTER TABLE "BaseLocaleBranding" DROP CONSTRAINT "FK_BaseLocaleBranding_backgroundId"`);
34
+ await queryRunner.query(`ALTER TABLE "BaseLocaleBranding" DROP CONSTRAINT "FK_BaseLocaleBranding_logoId"`);
35
+ await queryRunner.query(`ALTER TABLE "BaseLocaleBranding" DROP CONSTRAINT "FK_BackgroundAttributes_imageId"`);
36
+ await queryRunner.query(`ALTER TABLE "BaseLocaleBranding" DROP CONSTRAINT "FK_ImageAttributes_dimensionsId"`);
37
+ await queryRunner.query(`ALTER TABLE "IssuerBranding" DROP INDEX "IDX_IssuerBrandingEntity_issuerCorrelationId"`);
38
+ await queryRunner.query(`DROP TABLE "IssuerBranding"`);
39
+ await queryRunner.query(`ALTER TABLE "CredentialBranding" DROP INDEX "IDX_CredentialBrandingEntity_vcHash"`);
40
+ await queryRunner.query(`ALTER TABLE "CredentialBranding" DROP INDEX "IDX_CredentialBrandingEntity_issuerCorrelationId"`);
41
+ await queryRunner.query(`DROP TABLE "CredentialBranding"`);
42
+ await queryRunner.query(`ALTER TABLE "BaseLocaleBranding" DROP INDEX "IDX_BaseLocaleBranding_type"`);
43
+ await queryRunner.query(`ALTER TABLE "BaseLocaleBranding" DROP INDEX "IDX_IssuerLocaleBrandingEntity_issuerBranding_locale"`);
44
+ await queryRunner.query(`ALTER TABLE "BaseLocaleBranding" DROP INDEX "IDX_CredentialLocaleBrandingEntity_credentialBranding_locale"`);
45
+ await queryRunner.query(`ALTER TABLE "CredentialClaims" DROP INDEX "IDX_CredentialClaimsEntity_credentialLocaleBranding_locale"`);
46
+ await queryRunner.query(`DROP TABLE "CredentialClaims"`);
47
+ await queryRunner.query(`DROP TABLE "BaseLocaleBranding"`);
48
+ await queryRunner.query(`DROP TABLE "TextAttributes"`);
49
+ await queryRunner.query(`DROP TABLE "BackgroundAttributes"`);
50
+ await queryRunner.query(`DROP TABLE "ImageAttributes"`);
51
+ await queryRunner.query(`DROP TABLE "ImageDimensions"`);
70
52
  }
71
53
  }
72
- exports.CreateIssuanceBranding1685628974232 = CreateIssuanceBranding1685628974232;
73
54
  //# sourceMappingURL=1685628974232-CreateIssuanceBranding.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"1685628974232-CreateIssuanceBranding.js","sourceRoot":"","sources":["../../../src/migrations/postgres/1685628974232-CreateIssuanceBranding.ts"],"names":[],"mappings":";;;;;;;;;;;;AACA,yDAAoE;AAEpE,MAAa,mCAAmC;IAAhD;QACE,SAAI,GAAG,qCAAqC,CAAA;IA0F9C,CAAC;IAxFc,EAAE,CAAC,WAAwB;;YACtC,MAAM,IAAA,0CAA2B,EAAC,WAAW,CAAC,CAAA;YAC9C,MAAM,WAAW,CAAC,KAAK,CACrB,4LAA4L,CAC7L,CAAA;YACD,MAAM,WAAW,CAAC,KAAK,CACrB,0UAA0U,CAC3U,CAAA;YACD,MAAM,WAAW,CAAC,KAAK,CACrB,6OAA6O,CAC9O,CAAA;YACD,MAAM,WAAW,CAAC,KAAK,CACrB,qKAAqK,CACtK,CAAA;YACD,MAAM,WAAW,CAAC,KAAK,CACrB,ivBAAivB,CAClvB,CAAA;YACD,MAAM,WAAW,CAAC,KAAK,CACrB,+IAA+I,CAChJ,CAAA;YACD,MAAM,WAAW,CAAC,KAAK,CACrB,mIAAmI,CACpI,CAAA;YACD,MAAM,WAAW,CAAC,KAAK,CAAC,6EAA6E,CAAC,CAAA;YAEtG,MAAM,WAAW,CAAC,KAAK,CACrB,wQAAwQ,CAC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CAAA;YACjH,MAAM,WAAW,CAAC,KAAK,CAAC,6BAA6B,CAAC,CAAA;YACtD,MAAM,WAAW,CAAC,KAAK,CAAC,mFAAmF,CAAC,CAAA;YAC5G,MAAM,WAAW,CAAC,KAAK,CAAC,gGAAgG,CAAC,CAAA;YACzH,MAAM,WAAW,CAAC,KAAK,CAAC,iCAAiC,CAAC,CAAA;YAC1D,MAAM,WAAW,CAAC,KAAK,CAAC,2EAA2E,CAAC,CAAA;YACpG,MAAM,WAAW,CAAC,KAAK,CAAC,oGAAoG,CAAC,CAAA;YAC7H,MAAM,WAAW,CAAC,KAAK,CAAC,4GAA4G,CAAC,CAAA;YACrI,MAAM,WAAW,CAAC,KAAK,CAAC,wGAAwG,CAAC,CAAA;YACjI,MAAM,WAAW,CAAC,KAAK,CAAC,+BAA+B,CAAC,CAAA;YACxD,MAAM,WAAW,CAAC,KAAK,CAAC,iCAAiC,CAAC,CAAA;YAC1D,MAAM,WAAW,CAAC,KAAK,CAAC,6BAA6B,CAAC,CAAA;YACtD,MAAM,WAAW,CAAC,KAAK,CAAC,mCAAmC,CAAC,CAAA;YAC5D,MAAM,WAAW,CAAC,KAAK,CAAC,8BAA8B,CAAC,CAAA;YACvD,MAAM,WAAW,CAAC,KAAK,CAAC,8BAA8B,CAAC,CAAA;QACzD,CAAC;KAAA;CACF;AA3FD,kFA2FC"}
1
+ {"version":3,"file":"1685628974232-CreateIssuanceBranding.js","sourceRoot":"","sources":["../../../src/migrations/postgres/1685628974232-CreateIssuanceBranding.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,2BAA2B,EAAE,MAAM,wBAAwB,CAAA;AAEpE,MAAM,OAAO,mCAAmC;IAC9C,IAAI,GAAG,qCAAqC,CAAA;IAErC,KAAK,CAAC,EAAE,CAAC,WAAwB;QACtC,MAAM,2BAA2B,CAAC,WAAW,CAAC,CAAA;QAC9C,MAAM,WAAW,CAAC,KAAK,CACrB,4LAA4L,CAC7L,CAAA;QACD,MAAM,WAAW,CAAC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zD,CAAC;CACF"}
@@ -1,110 +1,91 @@
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.CreateContacts1690925872592 = void 0;
13
- const ssi_sdk_core_1 = require("@sphereon/ssi-sdk.core");
14
- class CreateContacts1690925872592 {
15
- constructor() {
16
- this.name = 'CreateContacts1690925872592';
1
+ import { enablePostgresUuidExtension } from '@sphereon/ssi-sdk.core';
2
+ export class CreateContacts1690925872592 {
3
+ name = 'CreateContacts1690925872592';
4
+ async up(queryRunner) {
5
+ await enablePostgresUuidExtension(queryRunner);
6
+ await queryRunner.query(`ALTER TABLE "CorrelationIdentifier" DROP CONSTRAINT "FK_CorrelationIdentifier_identityId"`);
7
+ await queryRunner.query(`ALTER TABLE "IdentityMetadata" DROP CONSTRAINT "FK_IdentityMetadata_identityId"`);
8
+ await queryRunner.query(`ALTER TABLE "Identity" DROP CONSTRAINT "FK_Identity_contactId"`);
9
+ await queryRunner.query(`ALTER TABLE "Connection" DROP CONSTRAINT "FK_Connection_identityId"`);
10
+ await queryRunner.query(`ALTER TABLE "CorrelationIdentifier" RENAME COLUMN "identityId" TO "identity_id"`);
11
+ await queryRunner.query(`ALTER TABLE "Connection" RENAME COLUMN "identityId" TO "identity_id"`);
12
+ await queryRunner.query(`CREATE TYPE "public"."PartyType_type_enum" AS ENUM('naturalPerson', 'organization')`);
13
+ await queryRunner.query(`CREATE TYPE "public"."PartyOrigin_type_enum" AS ENUM('INTERNAL', 'EXTERNAL')`);
14
+ await 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"))`);
15
+ await queryRunner.query(`CREATE UNIQUE INDEX "IDX_PartyType_type_tenant_id" ON "PartyType" ("type", "tenant_id")`);
16
+ await 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"))`);
17
+ await queryRunner.query(`CREATE INDEX "IDX_BaseContact_type" ON "BaseContact" ("type")`);
18
+ await queryRunner.query(`CREATE TABLE "PartyRelationship" ("id" uuid NOT NULL DEFAULT uuid_generate_v4(), "left_id" uuid NOT NULL, "right_id" uuid NOT NULL, "created_at" TIMESTAMP NOT NULL DEFAULT now(), "last_updated_at" TIMESTAMP NOT NULL DEFAULT now(), CONSTRAINT "PK_PartyRelationship_id" PRIMARY KEY ("id"))`);
19
+ await queryRunner.query(`CREATE UNIQUE INDEX "IDX_PartyRelationship_left_right" ON "PartyRelationship" ("left_id", "right_id")`);
20
+ await queryRunner.query(`CREATE TABLE "ElectronicAddress" ("id" uuid NOT NULL DEFAULT uuid_generate_v4(), "type" character varying(255) NOT NULL, "electronic_address" character varying(255) NOT NULL, "created_at" TIMESTAMP NOT NULL DEFAULT now(), "last_updated_at" TIMESTAMP NOT NULL DEFAULT now(), "partyId" uuid, CONSTRAINT "PK_ElectronicAddress_id" PRIMARY KEY ("id"))`);
21
+ await queryRunner.query(`CREATE TABLE "PhysicalAddress" ("id" uuid NOT NULL DEFAULT uuid_generate_v4(), "type" character varying(255) NOT NULL, "street_name" character varying(255) NOT NULL, "street_number" character varying(255) NOT NULL, "postal_code" character varying(255) NOT NULL, "city_name" character varying(255) NOT NULL, "province_name" character varying(255) NOT NULL, "country_code" character varying(2) NOT NULL, "building_name" character varying(255), "partyId" uuid, "created_at" TIMESTAMP NOT NULL DEFAULT now(), "last_updated_at" TIMESTAMP NOT NULL DEFAULT now(), CONSTRAINT "PK_PhysicalAddress_id" PRIMARY KEY ("id"))`);
22
+ await queryRunner.query(`CREATE TABLE "Party" ("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(), "party_type_id" uuid NOT NULL, CONSTRAINT "PK_Party_id" PRIMARY KEY ("id"))`);
23
+ await queryRunner.query(`CREATE TABLE "BaseConfig" ("id" uuid NOT NULL DEFAULT uuid_generate_v4(), "identifier" character varying(255), "redirect_url" character varying(255), "session_id" character varying(255), "client_id" character varying(255), "client_secret" character varying(255), "scopes" text, "issuer" character varying(255), "dangerously_allow_insecure_http_requests" boolean, "client_auth_method" text, "type" character varying NOT NULL, "connection_id" uuid, CONSTRAINT "REL_BaseConfig_connection_id" UNIQUE ("connection_id"), CONSTRAINT "PK_BaseConfig_id" PRIMARY KEY ("id"))`);
24
+ await queryRunner.query(`CREATE INDEX "IDX_BaseConfig_type" ON "BaseConfig" ("type")`);
25
+ await queryRunner.query(`ALTER TABLE "Identity" RENAME COLUMN "contactId" TO "partyId"`);
26
+ await queryRunner.query(`ALTER TABLE "Identity" ALTER COLUMN "roles" SET NOT NULL`);
27
+ await queryRunner.query(`CREATE TYPE "public"."IdentityOrigin_type_enum" AS ENUM('INTERNAL', 'EXTERNAL')`);
28
+ await queryRunner.query(`ALTER TABLE "Identity" ADD COLUMN "origin" "public"."IdentityOrigin_type_enum" DEFAULT 'EXTERNAL' NOT NULL`);
29
+ await queryRunner.query(`ALTER TABLE "Identity" ALTER COLUMN "origin" DROP DEFAULT`);
30
+ await 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`);
31
+ await queryRunner.query(`ALTER TABLE "IdentityMetadata" ADD CONSTRAINT "FK_IdentityMetadata_identityId" FOREIGN KEY ("identityId") REFERENCES "Identity"("id") ON DELETE CASCADE ON UPDATE NO ACTION`);
32
+ await 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`);
33
+ await queryRunner.query(`ALTER TABLE "PartyRelationship" ADD CONSTRAINT "FK_PartyRelationship_left_id" FOREIGN KEY ("left_id") REFERENCES "Party"("id") ON DELETE CASCADE ON UPDATE NO ACTION`);
34
+ await queryRunner.query(`ALTER TABLE "PartyRelationship" ADD CONSTRAINT "FK_PartyRelationship_right_id" FOREIGN KEY ("right_id") REFERENCES "Party"("id") ON DELETE CASCADE ON UPDATE NO ACTION`);
35
+ await queryRunner.query(`ALTER TABLE "ElectronicAddress" ADD CONSTRAINT "FK_ElectronicAddress_partyId" FOREIGN KEY ("partyId") REFERENCES "Party"("id") ON DELETE CASCADE ON UPDATE NO ACTION`);
36
+ await queryRunner.query(`ALTER TABLE "PhysicalAddress" ADD CONSTRAINT "FK_PhysicalAddress_partyId" FOREIGN KEY ("partyId") REFERENCES "Party" ("id") ON DELETE CASCADE ON UPDATE NO ACTION`);
37
+ await queryRunner.query(`ALTER TABLE "Party" ADD CONSTRAINT "FK_Party_party_type_id" FOREIGN KEY ("party_type_id") REFERENCES "PartyType"("id") ON DELETE NO ACTION ON UPDATE NO ACTION`);
38
+ await queryRunner.query(`ALTER TABLE "Identity" ADD CONSTRAINT "FK_Identity_partyId" FOREIGN KEY ("partyId") REFERENCES "Party"("id") ON DELETE CASCADE ON UPDATE NO ACTION`);
39
+ await queryRunner.query(`ALTER TABLE "Connection" ADD CONSTRAINT "FK_Connection_identity_id" FOREIGN KEY ("identity_id") REFERENCES "Identity"("id") ON DELETE CASCADE ON UPDATE NO ACTION`);
40
+ await queryRunner.query(`ALTER TABLE "BaseConfig" ADD CONSTRAINT "FK_BaseConfig_connection_id" FOREIGN KEY ("connection_id") REFERENCES "Connection"("id") ON DELETE CASCADE ON UPDATE NO ACTION`);
41
+ // migrate existing data
42
+ await queryRunner.query(`ALTER TABLE "CorrelationIdentifier" RENAME CONSTRAINT "UQ_Correlation_id" TO "UQ_CorrelationIdentifier_correlation_id"`);
43
+ await queryRunner.query(`ALTER TABLE "Identity" RENAME CONSTRAINT "UQ_Identity_Alias" TO "UQ_Identity_alias"`);
44
+ await queryRunner.query(`INSERT INTO "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", "connectionId" FROM "BaseConfigEntity"`);
45
+ await queryRunner.query(`DROP TABLE "BaseConfigEntity"`);
46
+ await queryRunner.query(`INSERT INTO "PartyType"(id, type, origin, name, description, tenant_id, created_at, last_updated_at) VALUES ('3875c12e-fdaa-4ef6-a340-c936e054b627', 'organization', 'INTERNAL', 'Sphereon_default_organization_type', 'sphereon_default_organization', '95e09cfc-c974-4174-86aa-7bf1d5251fb4', now(), now())`);
47
+ await queryRunner.query(`INSERT INTO "PartyType"(id, type, origin, name, description, tenant_id, created_at, last_updated_at) VALUES ('7d248798-41ca-4fc1-a130-9934b43d532e', 'naturalPerson', 'INTERNAL', 'Sphereon_default_natural_person_type', 'sphereon_default_natural_person', '95e09cfc-c974-4174-86aa-7bf1d5251fb4', now(), now())`);
48
+ await queryRunner.query(`INSERT INTO "Party"(id, uri, created_at, last_updated_at, party_type_id) SELECT id, uri, created_at, last_updated_at, '3875c12e-fdaa-4ef6-a340-c936e054b627' FROM "Contact"`);
49
+ await queryRunner.query(`INSERT INTO "BaseContact"(id, legal_name, display_name, party_id, created_at, last_updated_at, type) SELECT id, name, alias, id, created_at, last_updated_at, 'Organization' FROM "Contact"`);
50
+ await queryRunner.query(`DROP TABLE "Contact"`);
17
51
  }
18
- up(queryRunner) {
19
- return __awaiter(this, void 0, void 0, function* () {
20
- yield (0, ssi_sdk_core_1.enablePostgresUuidExtension)(queryRunner);
21
- yield queryRunner.query(`ALTER TABLE "CorrelationIdentifier" DROP CONSTRAINT "FK_CorrelationIdentifier_identityId"`);
22
- yield queryRunner.query(`ALTER TABLE "IdentityMetadata" DROP CONSTRAINT "FK_IdentityMetadata_identityId"`);
23
- yield queryRunner.query(`ALTER TABLE "Identity" DROP CONSTRAINT "FK_Identity_contactId"`);
24
- yield queryRunner.query(`ALTER TABLE "Connection" DROP CONSTRAINT "FK_Connection_identityId"`);
25
- yield queryRunner.query(`ALTER TABLE "CorrelationIdentifier" RENAME COLUMN "identityId" TO "identity_id"`);
26
- yield queryRunner.query(`ALTER TABLE "Connection" RENAME COLUMN "identityId" TO "identity_id"`);
27
- yield queryRunner.query(`CREATE TYPE "public"."PartyType_type_enum" AS ENUM('naturalPerson', 'organization')`);
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, "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
- yield queryRunner.query(`CREATE UNIQUE INDEX "IDX_PartyType_type_tenant_id" ON "PartyType" ("type", "tenant_id")`);
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
- yield queryRunner.query(`CREATE INDEX "IDX_BaseContact_type" ON "BaseContact" ("type")`);
33
- yield queryRunner.query(`CREATE TABLE "PartyRelationship" ("id" uuid NOT NULL DEFAULT uuid_generate_v4(), "left_id" uuid NOT NULL, "right_id" uuid NOT NULL, "created_at" TIMESTAMP NOT NULL DEFAULT now(), "last_updated_at" TIMESTAMP NOT NULL DEFAULT now(), CONSTRAINT "PK_PartyRelationship_id" PRIMARY KEY ("id"))`);
34
- yield queryRunner.query(`CREATE UNIQUE INDEX "IDX_PartyRelationship_left_right" ON "PartyRelationship" ("left_id", "right_id")`);
35
- yield queryRunner.query(`CREATE TABLE "ElectronicAddress" ("id" uuid NOT NULL DEFAULT uuid_generate_v4(), "type" character varying(255) NOT NULL, "electronic_address" character varying(255) NOT NULL, "created_at" TIMESTAMP NOT NULL DEFAULT now(), "last_updated_at" TIMESTAMP NOT NULL DEFAULT now(), "partyId" uuid, CONSTRAINT "PK_ElectronicAddress_id" PRIMARY KEY ("id"))`);
36
- yield queryRunner.query(`CREATE TABLE "PhysicalAddress" ("id" uuid NOT NULL DEFAULT uuid_generate_v4(), "type" character varying(255) NOT NULL, "street_name" character varying(255) NOT NULL, "street_number" character varying(255) NOT NULL, "postal_code" character varying(255) NOT NULL, "city_name" character varying(255) NOT NULL, "province_name" character varying(255) NOT NULL, "country_code" character varying(2) NOT NULL, "building_name" character varying(255), "partyId" uuid, "created_at" TIMESTAMP NOT NULL DEFAULT now(), "last_updated_at" TIMESTAMP NOT NULL DEFAULT now(), CONSTRAINT "PK_PhysicalAddress_id" PRIMARY KEY ("id"))`);
37
- yield queryRunner.query(`CREATE TABLE "Party" ("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(), "party_type_id" uuid NOT NULL, CONSTRAINT "PK_Party_id" PRIMARY KEY ("id"))`);
38
- yield queryRunner.query(`CREATE TABLE "BaseConfig" ("id" uuid NOT NULL DEFAULT uuid_generate_v4(), "identifier" character varying(255), "redirect_url" character varying(255), "session_id" character varying(255), "client_id" character varying(255), "client_secret" character varying(255), "scopes" text, "issuer" character varying(255), "dangerously_allow_insecure_http_requests" boolean, "client_auth_method" text, "type" character varying NOT NULL, "connection_id" uuid, CONSTRAINT "REL_BaseConfig_connection_id" UNIQUE ("connection_id"), CONSTRAINT "PK_BaseConfig_id" PRIMARY KEY ("id"))`);
39
- yield queryRunner.query(`CREATE INDEX "IDX_BaseConfig_type" ON "BaseConfig" ("type")`);
40
- yield queryRunner.query(`ALTER TABLE "Identity" RENAME COLUMN "contactId" TO "partyId"`);
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`);
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`);
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`);
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`);
48
- yield queryRunner.query(`ALTER TABLE "PartyRelationship" ADD CONSTRAINT "FK_PartyRelationship_left_id" FOREIGN KEY ("left_id") REFERENCES "Party"("id") ON DELETE CASCADE ON UPDATE NO ACTION`);
49
- yield queryRunner.query(`ALTER TABLE "PartyRelationship" ADD CONSTRAINT "FK_PartyRelationship_right_id" FOREIGN KEY ("right_id") REFERENCES "Party"("id") ON DELETE CASCADE ON UPDATE NO ACTION`);
50
- yield queryRunner.query(`ALTER TABLE "ElectronicAddress" ADD CONSTRAINT "FK_ElectronicAddress_partyId" FOREIGN KEY ("partyId") REFERENCES "Party"("id") ON DELETE CASCADE ON UPDATE NO ACTION`);
51
- yield queryRunner.query(`ALTER TABLE "PhysicalAddress" ADD CONSTRAINT "FK_PhysicalAddress_partyId" FOREIGN KEY ("partyId") REFERENCES "Party" ("id") ON DELETE CASCADE ON UPDATE NO ACTION`);
52
- yield queryRunner.query(`ALTER TABLE "Party" ADD CONSTRAINT "FK_Party_party_type_id" FOREIGN KEY ("party_type_id") REFERENCES "PartyType"("id") ON DELETE NO ACTION ON UPDATE NO ACTION`);
53
- yield queryRunner.query(`ALTER TABLE "Identity" ADD CONSTRAINT "FK_Identity_partyId" FOREIGN KEY ("partyId") REFERENCES "Party"("id") ON DELETE CASCADE ON UPDATE NO ACTION`);
54
- yield queryRunner.query(`ALTER TABLE "Connection" ADD CONSTRAINT "FK_Connection_identity_id" FOREIGN KEY ("identity_id") REFERENCES "Identity"("id") ON DELETE CASCADE ON UPDATE NO ACTION`);
55
- yield queryRunner.query(`ALTER TABLE "BaseConfig" ADD CONSTRAINT "FK_BaseConfig_connection_id" FOREIGN KEY ("connection_id") REFERENCES "Connection"("id") ON DELETE CASCADE ON UPDATE NO ACTION`);
56
- // migrate existing data
57
- yield queryRunner.query(`ALTER TABLE "CorrelationIdentifier" RENAME CONSTRAINT "UQ_Correlation_id" TO "UQ_CorrelationIdentifier_correlation_id"`);
58
- yield queryRunner.query(`ALTER TABLE "Identity" RENAME CONSTRAINT "UQ_Identity_Alias" TO "UQ_Identity_alias"`);
59
- yield queryRunner.query(`INSERT INTO "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", "connectionId" FROM "BaseConfigEntity"`);
60
- yield queryRunner.query(`DROP TABLE "BaseConfigEntity"`);
61
- yield queryRunner.query(`INSERT INTO "PartyType"(id, type, origin, name, description, tenant_id, created_at, last_updated_at) VALUES ('3875c12e-fdaa-4ef6-a340-c936e054b627', 'organization', 'INTERNAL', 'Sphereon_default_organization_type', 'sphereon_default_organization', '95e09cfc-c974-4174-86aa-7bf1d5251fb4', now(), now())`);
62
- yield queryRunner.query(`INSERT INTO "PartyType"(id, type, origin, name, description, tenant_id, created_at, last_updated_at) VALUES ('7d248798-41ca-4fc1-a130-9934b43d532e', 'naturalPerson', 'INTERNAL', 'Sphereon_default_natural_person_type', 'sphereon_default_natural_person', '95e09cfc-c974-4174-86aa-7bf1d5251fb4', now(), now())`);
63
- yield queryRunner.query(`INSERT INTO "Party"(id, uri, created_at, last_updated_at, party_type_id) SELECT id, uri, created_at, last_updated_at, '3875c12e-fdaa-4ef6-a340-c936e054b627' FROM "Contact"`);
64
- yield queryRunner.query(`INSERT INTO "BaseContact"(id, legal_name, display_name, party_id, created_at, last_updated_at, type) SELECT id, name, alias, id, created_at, last_updated_at, 'Organization' FROM "Contact"`);
65
- yield queryRunner.query(`DROP TABLE "Contact"`);
66
- });
67
- }
68
- down(queryRunner) {
69
- return __awaiter(this, void 0, void 0, function* () {
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'`);
106
- });
52
+ async down(queryRunner) {
53
+ await queryRunner.query(`ALTER TABLE "BaseConfig" DROP CONSTRAINT "FK_BaseConfig_connection_id"`);
54
+ await queryRunner.query(`ALTER TABLE "Connection" DROP CONSTRAINT "FK_Connection_identity_id"`);
55
+ await queryRunner.query(`ALTER TABLE "Identity" DROP CONSTRAINT "FK_Identity_partyId"`);
56
+ await queryRunner.query(`ALTER TABLE "Party" DROP CONSTRAINT "FK_Party_party_type_id"`);
57
+ await queryRunner.query(`ALTER TABLE "PhysicalAddress" DROP CONSTRAINT "FK_PhysicalAddress_partyId"`);
58
+ await queryRunner.query(`ALTER TABLE "ElectronicAddress" DROP CONSTRAINT "FK_ElectronicAddress_partyId"`);
59
+ await queryRunner.query(`ALTER TABLE "PartyRelationship" DROP CONSTRAINT "FK_PartyRelationship_right_id"`);
60
+ await queryRunner.query(`ALTER TABLE "PartyRelationship" DROP CONSTRAINT "FK_PartyRelationship_left_id"`);
61
+ await queryRunner.query(`ALTER TABLE "BaseContact" DROP CONSTRAINT "FK_BaseContact_party_id"`);
62
+ await queryRunner.query(`ALTER TABLE "IdentityMetadata" DROP CONSTRAINT "FK_IdentityMetadata_identityId"`);
63
+ await queryRunner.query(`ALTER TABLE "CorrelationIdentifier" DROP CONSTRAINT "FK_CorrelationIdentifier_identity_id"`);
64
+ await queryRunner.query(`ALTER TABLE "Identity" ALTER COLUMN "roles" DROP NOT NULL`);
65
+ await queryRunner.query(`ALTER TABLE "Identity" DROP COLUMN "origin"`);
66
+ await queryRunner.query(`DROP TYPE "public"."IdentityOrigin_type_enum"`);
67
+ await queryRunner.query(`ALTER TABLE "Identity" RENAME COLUMN "partyId" TO "contactId"`);
68
+ await queryRunner.query(`ALTER TABLE "Connection" RENAME COLUMN "identity_id" TO "identityId"`);
69
+ await queryRunner.query(`ALTER TABLE "CorrelationIdentifier" RENAME COLUMN "identity_id" TO "identityId"`);
70
+ await queryRunner.query(`DROP INDEX "IDX_BaseConfig_type"`);
71
+ await queryRunner.query(`DROP TABLE "BaseConfig"`);
72
+ await queryRunner.query(`DROP TABLE "Party"`);
73
+ await queryRunner.query(`DROP INDEX "IDX_PartyRelationship_left_right"`);
74
+ await queryRunner.query(`DROP TABLE "PartyRelationship"`);
75
+ await queryRunner.query(`DROP INDEX "IDX_BaseContact_type"`);
76
+ await queryRunner.query(`DROP TABLE "BaseContact"`);
77
+ await queryRunner.query(`DROP TABLE "ElectronicAddress"`);
78
+ await queryRunner.query(`DROP TABLE "PhysicalAddress"`);
79
+ await queryRunner.query(`DROP INDEX "IDX_PartyType_type_tenant_id"`);
80
+ await queryRunner.query(`DROP TABLE "PartyType"`);
81
+ await queryRunner.query(`DROP TYPE "public"."PartyOrigin_type_enum"`);
82
+ await queryRunner.query(`DROP TYPE "public"."PartyType_type_enum"`);
83
+ await queryRunner.query(`ALTER TABLE "Connection" ADD CONSTRAINT "FK_Connection_identityId" FOREIGN KEY ("identityId") REFERENCES "Identity"("id") ON DELETE CASCADE ON UPDATE NO ACTION`);
84
+ await queryRunner.query(`ALTER TABLE "Identity" ADD CONSTRAINT "FK_Identity_contactId" FOREIGN KEY ("contactId") REFERENCES "Contact"("id") ON DELETE CASCADE ON UPDATE NO ACTION`);
85
+ await queryRunner.query(`ALTER TABLE "IdentityMetadata" ADD CONSTRAINT "FK_IdentityMetadata_identityId" FOREIGN KEY ("identityId") REFERENCES "Identity"("id") ON DELETE CASCADE ON UPDATE NO ACTION`);
86
+ await queryRunner.query(`ALTER TABLE "CorrelationIdentifier" ADD CONSTRAINT "FK_CorrelationIdentifier_identityId" FOREIGN KEY ("identityId") REFERENCES "Identity"("id") ON DELETE CASCADE ON UPDATE NO ACTION`);
87
+ await 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"))`);
88
+ await 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'`);
107
89
  }
108
90
  }
109
- exports.CreateContacts1690925872592 = CreateContacts1690925872592;
110
91
  //# sourceMappingURL=1690925872592-CreateContacts.js.map
@@ -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,SAA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YAC3D,MAAM,WAAW,CAAC,KAAK,CAAC,yBAAyB,CAAC,CAAA;YAClD,MAAM,WAAW,CAAC,KAAK,CAAC,oBAAoB,CAAC,CAAA;YAC7C,MAAM,WAAW,CAAC,KAAK,CAAC,+CAA+C,CAAC,CAAA;YACxE,MAAM,WAAW,CAAC,KAAK,CAAC,gCAAgC,CAAC,CAAA;YACzD,MAAM,WAAW,CAAC,KAAK,CAAC,mCAAmC,CAAC,CAAA;YAC5D,MAAM,WAAW,CAAC,KAAK,CAAC,0BAA0B,CAAC,CAAA;YACnD,MAAM,WAAW,CAAC,KAAK,CAAC,gCAAgC,CAAC,CAAA;YACzD,MAAM,WAAW,CAAC,KAAK,CAAC,8BAA8B,CAAC,CAAA;YACvD,MAAM,WAAW,CAAC,KAAK,CAAC,2CAA2C,CAAC,CAAA;YACpE,MAAM,WAAW,CAAC,KAAK,CAAC,wBAAwB,CAAC,CAAA;YACjD,MAAM,WAAW,CAAC,KAAK,CAAC,4CAA4C,CAAC,CAAA;YACrE,MAAM,WAAW,CAAC,KAAK,CAAC,0CAA0C,CAAC,CAAA;YAEnE,MAAM,WAAW,CAAC,KAAK,CACrB,iKAAiK,CAClK,CAAA;YACD,MAAM,WAAW,CAAC,KAAK,CACrB,0JAA0J,CAC3J,CAAA;YACD,MAAM,WAAW,CAAC,KAAK,CACrB,6KAA6K,CAC9K,CAAA;YACD,MAAM,WAAW,CAAC,KAAK,CACrB,uLAAuL,CACxL,CAAA;YAED,MAAM,WAAW,CAAC,KAAK,CACrB,uTAAuT,CACxT,CAAA;YACD,MAAM,WAAW,CAAC,KAAK,CACrB,8WAA8W,CAC/W,CAAA;QACH,CAAC;KAAA;CACF;AA1JD,kEA0JC"}
1
+ {"version":3,"file":"1690925872592-CreateContacts.js","sourceRoot":"","sources":["../../../src/migrations/postgres/1690925872592-CreateContacts.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,2BAA2B,EAAE,MAAM,wBAAwB,CAAA;AAEpE,MAAM,OAAO,2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CAAC,CAAA;QAC3D,MAAM,WAAW,CAAC,KAAK,CAAC,yBAAyB,CAAC,CAAA;QAClD,MAAM,WAAW,CAAC,KAAK,CAAC,oBAAoB,CAAC,CAAA;QAC7C,MAAM,WAAW,CAAC,KAAK,CAAC,+CAA+C,CAAC,CAAA;QACxE,MAAM,WAAW,CAAC,KAAK,CAAC,gCAAgC,CAAC,CAAA;QACzD,MAAM,WAAW,CAAC,KAAK,CAAC,mCAAmC,CAAC,CAAA;QAC5D,MAAM,WAAW,CAAC,KAAK,CAAC,0BAA0B,CAAC,CAAA;QACnD,MAAM,WAAW,CAAC,KAAK,CAAC,gCAAgC,CAAC,CAAA;QACzD,MAAM,WAAW,CAAC,KAAK,CAAC,8BAA8B,CAAC,CAAA;QACvD,MAAM,WAAW,CAAC,KAAK,CAAC,2CAA2C,CAAC,CAAA;QACpE,MAAM,WAAW,CAAC,KAAK,CAAC,wBAAwB,CAAC,CAAA;QACjD,MAAM,WAAW,CAAC,KAAK,CAAC,4CAA4C,CAAC,CAAA;QACrE,MAAM,WAAW,CAAC,KAAK,CAAC,0CAA0C,CAAC,CAAA;QAEnE,MAAM,WAAW,CAAC,KAAK,CACrB,iKAAiK,CAClK,CAAA;QACD,MAAM,WAAW,CAAC,KAAK,CACrB,0JAA0J,CAC3J,CAAA;QACD,MAAM,WAAW,CAAC,KAAK,CACrB,6KAA6K,CAC9K,CAAA;QACD,MAAM,WAAW,CAAC,KAAK,CACrB,uLAAuL,CACxL,CAAA;QAED,MAAM,WAAW,CAAC,KAAK,CACrB,uTAAuT,CACxT,CAAA;QACD,MAAM,WAAW,CAAC,KAAK,CACrB,8WAA8W,CAC/W,CAAA;IACH,CAAC;CACF"}
@@ -1,25 +1,10 @@
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.CreateStatusList1693866470001 = void 0;
13
- class CreateStatusList1693866470001 {
14
- constructor() {
15
- this.name = 'CreateStatusList1693866470001';
16
- }
17
- up(queryRunner) {
18
- return __awaiter(this, void 0, void 0, function* () {
19
- yield queryRunner.query(`CREATE TYPE "StatusList_type_enum" AS ENUM('StatusList2021')`);
20
- yield queryRunner.query(`CREATE TYPE "StatusList_drivertype_enum" AS ENUM('agent_typeorm', 'agent_kv_store', 'github', 'agent_filesystem')`);
21
- yield queryRunner.query(`CREATE TYPE "StatusList_credentialidmode_enum" AS ENUM('ISSUANCE', 'PERSISTENCE', 'NEVER')`);
22
- yield queryRunner.query(`CREATE TABLE "StatusListEntry"
1
+ export class CreateStatusList1693866470001 {
2
+ name = 'CreateStatusList1693866470001';
3
+ async up(queryRunner) {
4
+ await queryRunner.query(`CREATE TYPE "StatusList_type_enum" AS ENUM('StatusList2021')`);
5
+ await queryRunner.query(`CREATE TYPE "StatusList_drivertype_enum" AS ENUM('agent_typeorm', 'agent_kv_store', 'github', 'agent_filesystem')`);
6
+ await queryRunner.query(`CREATE TYPE "StatusList_credentialidmode_enum" AS ENUM('ISSUANCE', 'PERSISTENCE', 'NEVER')`);
7
+ await queryRunner.query(`CREATE TABLE "StatusListEntry"
23
8
  (
24
9
  "statusListId" character varying NOT NULL,
25
10
  "statusListIndex" integer NOT NULL,
@@ -29,7 +14,7 @@ class CreateStatusList1693866470001 {
29
14
  "value" character varying(50),
30
15
  CONSTRAINT "PK_68704d2d13857360c6b44a3d1d0" PRIMARY KEY ("statusListId", "statusListIndex")
31
16
  )`);
32
- yield queryRunner.query(`CREATE TABLE "StatusList"
17
+ await queryRunner.query(`CREATE TABLE "StatusList"
33
18
  (
34
19
  "id" character varying NOT NULL,
35
20
  "correlationId" character varying NOT NULL,
@@ -45,21 +30,17 @@ class CreateStatusList1693866470001 {
45
30
  CONSTRAINT "UQ_correlationId" UNIQUE ("correlationId"),
46
31
  CONSTRAINT "PK_StatusList_Id" PRIMARY KEY ("id")
47
32
  )`);
48
- yield queryRunner.query(`ALTER TABLE "StatusListEntry"
33
+ await queryRunner.query(`ALTER TABLE "StatusListEntry"
49
34
  ADD CONSTRAINT "FK_statusListEntry_statusListId" FOREIGN KEY ("statusListId") REFERENCES "StatusList" ("id") ON DELETE NO ACTION ON UPDATE NO ACTION`);
50
- });
51
35
  }
52
- down(queryRunner) {
53
- return __awaiter(this, void 0, void 0, function* () {
54
- yield queryRunner.query(`ALTER TABLE "StatusListEntry"
36
+ async down(queryRunner) {
37
+ await queryRunner.query(`ALTER TABLE "StatusListEntry"
55
38
  DROP CONSTRAINT "FK_statusListEntry_statusListId"`);
56
- yield queryRunner.query(`DROP TABLE "StatusListEntry"`);
57
- yield queryRunner.query(`DROP TABLE "StatusList"`);
58
- yield queryRunner.query(`DROP TYPE "StatusList_credentialidmode_enum"`);
59
- yield queryRunner.query(`DROP TYPE "StatusList_drivertype_enum"`);
60
- yield queryRunner.query(`DROP TYPE "StatusList_type_enum"`);
61
- });
39
+ await queryRunner.query(`DROP TABLE "StatusListEntry"`);
40
+ await queryRunner.query(`DROP TABLE "StatusList"`);
41
+ await queryRunner.query(`DROP TYPE "StatusList_credentialidmode_enum"`);
42
+ await queryRunner.query(`DROP TYPE "StatusList_drivertype_enum"`);
43
+ await queryRunner.query(`DROP TYPE "StatusList_type_enum"`);
62
44
  }
63
45
  }
64
- exports.CreateStatusList1693866470001 = CreateStatusList1693866470001;
65
46
  //# sourceMappingURL=1693866470001-CreateStatusList.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"1693866470001-CreateStatusList.js","sourceRoot":"","sources":["../../../src/migrations/postgres/1693866470001-CreateStatusList.ts"],"names":[],"mappings":";;;;;;;;;;;;AAGA,MAAa,6BAA6B;IAA1C;QACE,SAAI,GAAG,+BAA+B,CAAA;IAoDxC,CAAC;IAlDc,EAAE,CAAC,WAAwB;;YACtC,MAAM,WAAW,CAAC,KAAK,CAAC,8DAA8D,CAAC,CAAA;YACvF,MAAM,WAAW,CAAC,KAAK,CAAC,mHAAmH,CAAC,CAAA;YAC5I,MAAM,WAAW,CAAC,KAAK,CAAC,4FAA4F,CAAC,CAAA;YAErH,MAAM,WAAW,CAAC,KAAK,CACrB;;;;;;;;;eASS,CACV,CAAA;YACD,MAAM,WAAW,CAAC,KAAK,CACrB;;;;;;;;;;;;;;;eAeS,CACV,CAAA;YACD,MAAM,WAAW,CAAC,KAAK,CACrB;qKAC+J,CAChK,CAAA;QACH,CAAC;KAAA;IAEY,IAAI,CAAC,WAAwB;;YACxC,MAAM,WAAW,CAAC,KAAK,CAAC;8DACkC,CAAC,CAAA;YAC3D,MAAM,WAAW,CAAC,KAAK,CAAC,8BAA8B,CAAC,CAAA;YACvD,MAAM,WAAW,CAAC,KAAK,CAAC,yBAAyB,CAAC,CAAA;YAClD,MAAM,WAAW,CAAC,KAAK,CAAC,8CAA8C,CAAC,CAAA;YACvE,MAAM,WAAW,CAAC,KAAK,CAAC,wCAAwC,CAAC,CAAA;YACjE,MAAM,WAAW,CAAC,KAAK,CAAC,kCAAkC,CAAC,CAAA;QAC7D,CAAC;KAAA;CACF;AArDD,sEAqDC"}
1
+ {"version":3,"file":"1693866470001-CreateStatusList.js","sourceRoot":"","sources":["../../../src/migrations/postgres/1693866470001-CreateStatusList.ts"],"names":[],"mappings":"AAGA,MAAM,OAAO,6BAA6B;IACxC,IAAI,GAAG,+BAA+B,CAAA;IAE/B,KAAK,CAAC,EAAE,CAAC,WAAwB;QACtC,MAAM,WAAW,CAAC,KAAK,CAAC,8DAA8D,CAAC,CAAA;QACvF,MAAM,WAAW,CAAC,KAAK,CAAC,mHAAmH,CAAC,CAAA;QAC5I,MAAM,WAAW,CAAC,KAAK,CAAC,4FAA4F,CAAC,CAAA;QAErH,MAAM,WAAW,CAAC,KAAK,CACrB;;;;;;;;;eASS,CACV,CAAA;QACD,MAAM,WAAW,CAAC,KAAK,CACrB;;;;;;;;;;;;;;;eAeS,CACV,CAAA;QACD,MAAM,WAAW,CAAC,KAAK,CACrB;qKAC+J,CAChK,CAAA;IACH,CAAC;IAEM,KAAK,CAAC,IAAI,CAAC,WAAwB;QACxC,MAAM,WAAW,CAAC,KAAK,CAAC;8DACkC,CAAC,CAAA;QAC3D,MAAM,WAAW,CAAC,KAAK,CAAC,8BAA8B,CAAC,CAAA;QACvD,MAAM,WAAW,CAAC,KAAK,CAAC,yBAAyB,CAAC,CAAA;QAClD,MAAM,WAAW,CAAC,KAAK,CAAC,8CAA8C,CAAC,CAAA;QACvE,MAAM,WAAW,CAAC,KAAK,CAAC,wCAAwC,CAAC,CAAA;QACjE,MAAM,WAAW,CAAC,KAAK,CAAC,kCAAkC,CAAC,CAAA;IAC7D,CAAC;CACF"}