@sphereon/ssi-sdk.data-store 0.23.5-unstable.88 → 0.24.0

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 (146) hide show
  1. package/LICENSE +201 -201
  2. package/README.md +77 -77
  3. package/dist/index.d.ts +3 -9
  4. package/dist/index.d.ts.map +1 -1
  5. package/dist/index.js +2 -15
  6. package/dist/index.js.map +1 -1
  7. package/dist/migrations/generic/index.d.ts +0 -2
  8. package/dist/migrations/generic/index.d.ts.map +1 -1
  9. package/dist/migrations/generic/index.js +1 -4
  10. package/dist/migrations/generic/index.js.map +1 -1
  11. package/dist/migrations/index.d.ts +1 -1
  12. package/dist/migrations/index.d.ts.map +1 -1
  13. package/dist/migrations/index.js +1 -2
  14. package/dist/migrations/index.js.map +1 -1
  15. package/dist/migrations/postgres/1690925872592-CreateContacts.js +1 -1
  16. package/dist/migrations/postgres/1690925872592-CreateContacts.js.map +1 -1
  17. package/dist/migrations/postgres/1708525189001-CreateDigitalCredential.js +22 -22
  18. package/dist/migrations/postgres/1708797018115-CreateMachineStateStore.js +16 -16
  19. package/dist/migrations/sqlite/1708525189002-CreateDigitalCredential.js +21 -21
  20. package/dist/migrations/sqlite/1708796002272-CreateMachineStateStore.js +15 -15
  21. package/dist/types/index.d.ts +0 -2
  22. package/dist/types/index.d.ts.map +1 -1
  23. package/dist/types/index.js +0 -2
  24. package/dist/types/index.js.map +1 -1
  25. package/package.json +4 -5
  26. package/src/__tests__/contact.entities.test.ts +2542 -2542
  27. package/src/__tests__/contact.store.test.ts +2471 -2471
  28. package/src/__tests__/digitalCredential.entities.test.ts +254 -254
  29. package/src/__tests__/digitalCredential.store.test.ts +294 -294
  30. package/src/__tests__/eventLogger.entities.test.ts +73 -73
  31. package/src/__tests__/eventLogger.store.test.ts +136 -136
  32. package/src/__tests__/issuanceBranding.entities.test.ts +844 -844
  33. package/src/__tests__/issuanceBranding.store.test.ts +1884 -1884
  34. package/src/__tests__/machineState.entities.test.ts +51 -51
  35. package/src/__tests__/machineState.store.test.ts +174 -174
  36. package/src/contact/AbstractContactStore.ts +71 -71
  37. package/src/contact/ContactStore.ts +723 -723
  38. package/src/digitalCredential/AbstractDigitalCredentialStore.ts +17 -17
  39. package/src/digitalCredential/DigitalCredentialStore.ts +127 -127
  40. package/src/entities/contact/BaseContactEntity.ts +39 -39
  41. package/src/entities/contact/ConnectionEntity.ts +29 -29
  42. package/src/entities/contact/CorrelationIdentifierEntity.ts +37 -37
  43. package/src/entities/contact/DidAuthConfigEntity.ts +14 -14
  44. package/src/entities/contact/ElectronicAddressEntity.ts +63 -63
  45. package/src/entities/contact/IdentityEntity.ts +97 -97
  46. package/src/entities/contact/IdentityMetadataItemEntity.ts +35 -35
  47. package/src/entities/contact/NaturalPersonEntity.ts +38 -38
  48. package/src/entities/contact/OpenIdConfigEntity.ts +26 -26
  49. package/src/entities/contact/OrganizationEntity.ts +34 -34
  50. package/src/entities/contact/PartyEntity.ts +110 -110
  51. package/src/entities/contact/PartyRelationshipEntity.ts +61 -61
  52. package/src/entities/contact/PartyTypeEntity.ts +62 -62
  53. package/src/entities/contact/PhysicalAddressEntity.ts +87 -87
  54. package/src/entities/digitalCredential/DigitalCredentialEntity.ts +64 -64
  55. package/src/entities/eventLogger/AuditEventEntity.ts +99 -99
  56. package/src/entities/issuanceBranding/CredentialBrandingEntity.ts +78 -78
  57. package/src/entities/issuanceBranding/ImageAttributesEntity.ts +57 -57
  58. package/src/entities/issuanceBranding/IssuerBrandingEntity.ts +72 -72
  59. package/src/entities/machineState/MachineStateInfoEntity.ts +58 -58
  60. package/src/entities/statusList2021/StatusList2021Entity.ts +96 -96
  61. package/src/eventLogger/AbstractEventLoggerStore.ts +7 -7
  62. package/src/eventLogger/EventLoggerStore.ts +62 -62
  63. package/src/index.ts +141 -154
  64. package/src/issuanceBranding/IssuanceBrandingStore.ts +559 -559
  65. package/src/machineState/IAbstractMachineStateStore.ts +65 -65
  66. package/src/machineState/MachineStateStore.ts +149 -149
  67. package/src/migrations/generic/1-CreateContacts.ts +66 -66
  68. package/src/migrations/generic/2-CreateIssuanceBranding.ts +64 -64
  69. package/src/migrations/generic/3-CreateContacts.ts +66 -66
  70. package/src/migrations/generic/4-CreateStatusList.ts +54 -54
  71. package/src/migrations/generic/5-CreateAuditEvents.ts +66 -66
  72. package/src/migrations/generic/6-CreateDigitalCredential.ts +66 -66
  73. package/src/migrations/generic/7-CreateMachineStateStore.ts +66 -66
  74. package/src/migrations/generic/index.ts +33 -36
  75. package/src/migrations/index.ts +9 -10
  76. package/src/migrations/postgres/1659463079428-CreateContacts.ts +63 -63
  77. package/src/migrations/postgres/1685628974232-CreateIssuanceBranding.ts +85 -85
  78. package/src/migrations/postgres/1690925872592-CreateContacts.ts +104 -104
  79. package/src/migrations/postgres/1693866470001-CreateStatusList.ts +24 -24
  80. package/src/migrations/postgres/1701634812183-CreateAuditEvents.ts +33 -33
  81. package/src/migrations/postgres/1708525189001-CreateDigitalCredential.ts +44 -44
  82. package/src/migrations/postgres/1708797018115-CreateMachineStateStore.ts +29 -29
  83. package/src/migrations/sqlite/1659463069549-CreateContacts.ts +110 -110
  84. package/src/migrations/sqlite/1685628973231-CreateIssuanceBranding.ts +119 -119
  85. package/src/migrations/sqlite/1690925872693-CreateContacts.ts +161 -161
  86. package/src/migrations/sqlite/1693866470000-CreateStatusList.ts +24 -24
  87. package/src/migrations/sqlite/1701634819487-CreateAuditEvents.ts +15 -15
  88. package/src/migrations/sqlite/1708525189002-CreateDigitalCredential.ts +34 -34
  89. package/src/migrations/sqlite/1708796002272-CreateMachineStateStore.ts +28 -28
  90. package/src/statusList/StatusListStore.ts +237 -237
  91. package/src/types/contact/IAbstractContactStore.ts +161 -161
  92. package/src/types/contact/contact.ts +237 -237
  93. package/src/types/digitalCredential/IAbstractDigitalCredentialStore.ts +37 -37
  94. package/src/types/digitalCredential/digitalCredential.ts +46 -46
  95. package/src/types/eventLogger/IAbstractEventLoggerStore.ts +12 -12
  96. package/src/types/eventLogger/eventLogger.ts +3 -3
  97. package/src/types/index.ts +10 -12
  98. package/src/types/machineState/IAbstractMachineStateStore.ts +68 -68
  99. package/src/utils/SortingUtils.ts +16 -16
  100. package/src/utils/contact/MappingUtils.ts +385 -385
  101. package/src/utils/digitalCredential/MappingUtils.ts +122 -122
  102. package/dist/entities/presentationDefinitions/PresentationDefinitionItemEntity.d.ts +0 -13
  103. package/dist/entities/presentationDefinitions/PresentationDefinitionItemEntity.d.ts.map +0 -1
  104. package/dist/entities/presentationDefinitions/PresentationDefinitionItemEntity.js +0 -71
  105. package/dist/entities/presentationDefinitions/PresentationDefinitionItemEntity.js.map +0 -1
  106. package/dist/migrations/generic/8-CreatePresentationDefinitions.d.ts +0 -7
  107. package/dist/migrations/generic/8-CreatePresentationDefinitions.d.ts.map +0 -1
  108. package/dist/migrations/generic/8-CreatePresentationDefinitions.js +0 -78
  109. package/dist/migrations/generic/8-CreatePresentationDefinitions.js.map +0 -1
  110. package/dist/migrations/postgres/1716475165345-CreatePresentationDefinitions.d.ts +0 -7
  111. package/dist/migrations/postgres/1716475165345-CreatePresentationDefinitions.d.ts.map +0 -1
  112. package/dist/migrations/postgres/1716475165345-CreatePresentationDefinitions.js +0 -40
  113. package/dist/migrations/postgres/1716475165345-CreatePresentationDefinitions.js.map +0 -1
  114. package/dist/migrations/sqlite/1716475165344-CreatePresentationDefinitions.d.ts +0 -7
  115. package/dist/migrations/sqlite/1716475165344-CreatePresentationDefinitions.d.ts.map +0 -1
  116. package/dist/migrations/sqlite/1716475165344-CreatePresentationDefinitions.js +0 -37
  117. package/dist/migrations/sqlite/1716475165344-CreatePresentationDefinitions.js.map +0 -1
  118. package/dist/pd/AbstractPDStore.d.ts +0 -10
  119. package/dist/pd/AbstractPDStore.d.ts.map +0 -1
  120. package/dist/pd/AbstractPDStore.js +0 -7
  121. package/dist/pd/AbstractPDStore.js.map +0 -1
  122. package/dist/pd/PDStore.d.ts +0 -14
  123. package/dist/pd/PDStore.d.ts.map +0 -1
  124. package/dist/pd/PDStore.js +0 -90
  125. package/dist/pd/PDStore.js.map +0 -1
  126. package/dist/types/pd/IAbstractPDStore.d.ts +0 -14
  127. package/dist/types/pd/IAbstractPDStore.d.ts.map +0 -1
  128. package/dist/types/pd/IAbstractPDStore.js +0 -3
  129. package/dist/types/pd/IAbstractPDStore.js.map +0 -1
  130. package/dist/types/pd/pd.d.ts +0 -15
  131. package/dist/types/pd/pd.d.ts.map +0 -1
  132. package/dist/types/pd/pd.js +0 -3
  133. package/dist/types/pd/pd.js.map +0 -1
  134. package/dist/utils/presentationDefinitions/MappingUtils.d.ts +0 -6
  135. package/dist/utils/presentationDefinitions/MappingUtils.d.ts.map +0 -1
  136. package/dist/utils/presentationDefinitions/MappingUtils.js +0 -50
  137. package/dist/utils/presentationDefinitions/MappingUtils.js.map +0 -1
  138. package/src/entities/presentationDefinitions/PresentationDefinitionItemEntity.ts +0 -41
  139. package/src/migrations/generic/8-CreatePresentationDefinitions.ts +0 -66
  140. package/src/migrations/postgres/1716475165345-CreatePresentationDefinitions.ts +0 -24
  141. package/src/migrations/sqlite/1716475165344-CreatePresentationDefinitions.ts +0 -23
  142. package/src/pd/AbstractPDStore.ts +0 -10
  143. package/src/pd/PDStore.ts +0 -103
  144. package/src/types/pd/IAbstractPDStore.ts +0 -19
  145. package/src/types/pd/pd.ts +0 -16
  146. package/src/utils/presentationDefinitions/MappingUtils.ts +0 -54
@@ -1,66 +1,66 @@
1
- import { DatabaseType, MigrationInterface, QueryRunner } from 'typeorm'
2
- import Debug from 'debug'
3
- import { CreateMachineStateStore1708797018115 } from '../postgres/1708797018115-CreateMachineStateStore'
4
- import { CreateMachineStateStore1708796002272 } from '../sqlite/1708796002272-CreateMachineStateStore'
5
-
6
- const debug: Debug.Debugger = Debug('sphereon:ssi-sdk:migrations')
7
-
8
- export class CreateMachineStateStore1708098041262 implements MigrationInterface {
9
- name = 'CreateMachineStateStore1708098041262'
10
-
11
- public async up(queryRunner: QueryRunner): Promise<void> {
12
- debug('migration: creating machine state tables')
13
- const dbType: DatabaseType = queryRunner.connection.driver.options.type
14
-
15
- switch (dbType) {
16
- case 'postgres': {
17
- debug('using postgres migration file')
18
- const mig: CreateMachineStateStore1708797018115 = new CreateMachineStateStore1708797018115()
19
- await mig.up(queryRunner)
20
- debug('Migration statements executed')
21
- return
22
- }
23
- case 'sqlite':
24
- case 'expo':
25
- case 'react-native': {
26
- debug('using sqlite/react-native migration file')
27
- const mig: CreateMachineStateStore1708796002272 = new CreateMachineStateStore1708796002272()
28
- await mig.up(queryRunner)
29
- debug('Migration statements executed')
30
- return
31
- }
32
- default:
33
- return Promise.reject(
34
- `Migrations are currently only supported for sqlite, react-native, expo and postgres. Was ${dbType}. Please run your database without migrations and with 'migrationsRun: false' and 'synchronize: true' for now`,
35
- )
36
- }
37
- }
38
-
39
- public async down(queryRunner: QueryRunner): Promise<void> {
40
- debug('migration: reverting machine state tables')
41
- const dbType: DatabaseType = queryRunner.connection.driver.options.type
42
-
43
- switch (dbType) {
44
- case 'postgres': {
45
- debug('using postgres migration file')
46
- const mig: CreateMachineStateStore1708797018115 = new CreateMachineStateStore1708797018115()
47
- await mig.down(queryRunner)
48
- debug('Migration statements executed')
49
- return
50
- }
51
- case 'sqlite':
52
- case 'expo':
53
- case 'react-native': {
54
- debug('using sqlite/react-native migration file')
55
- const mig: CreateMachineStateStore1708796002272 = new CreateMachineStateStore1708796002272()
56
- await mig.down(queryRunner)
57
- debug('Migration statements executed')
58
- return
59
- }
60
- default:
61
- return Promise.reject(
62
- `Migrations are currently only supported for sqlite, react-native, expo and postgres. Was ${dbType}. Please run your database without migrations and with 'migrationsRun: false' and 'synchronize: true' for now`,
63
- )
64
- }
65
- }
66
- }
1
+ import { DatabaseType, MigrationInterface, QueryRunner } from 'typeorm'
2
+ import Debug from 'debug'
3
+ import { CreateMachineStateStore1708797018115 } from '../postgres/1708797018115-CreateMachineStateStore'
4
+ import { CreateMachineStateStore1708796002272 } from '../sqlite/1708796002272-CreateMachineStateStore'
5
+
6
+ const debug: Debug.Debugger = Debug('sphereon:ssi-sdk:migrations')
7
+
8
+ export class CreateMachineStateStore1708098041262 implements MigrationInterface {
9
+ name = 'CreateMachineStateStore1708098041262'
10
+
11
+ public async up(queryRunner: QueryRunner): Promise<void> {
12
+ debug('migration: creating machine state tables')
13
+ const dbType: DatabaseType = queryRunner.connection.driver.options.type
14
+
15
+ switch (dbType) {
16
+ case 'postgres': {
17
+ debug('using postgres migration file')
18
+ const mig: CreateMachineStateStore1708797018115 = new CreateMachineStateStore1708797018115()
19
+ await mig.up(queryRunner)
20
+ debug('Migration statements executed')
21
+ return
22
+ }
23
+ case 'sqlite':
24
+ case 'expo':
25
+ case 'react-native': {
26
+ debug('using sqlite/react-native migration file')
27
+ const mig: CreateMachineStateStore1708796002272 = new CreateMachineStateStore1708796002272()
28
+ await mig.up(queryRunner)
29
+ debug('Migration statements executed')
30
+ return
31
+ }
32
+ default:
33
+ return Promise.reject(
34
+ `Migrations are currently only supported for sqlite, react-native, expo and postgres. Was ${dbType}. Please run your database without migrations and with 'migrationsRun: false' and 'synchronize: true' for now`,
35
+ )
36
+ }
37
+ }
38
+
39
+ public async down(queryRunner: QueryRunner): Promise<void> {
40
+ debug('migration: reverting machine state tables')
41
+ const dbType: DatabaseType = queryRunner.connection.driver.options.type
42
+
43
+ switch (dbType) {
44
+ case 'postgres': {
45
+ debug('using postgres migration file')
46
+ const mig: CreateMachineStateStore1708797018115 = new CreateMachineStateStore1708797018115()
47
+ await mig.down(queryRunner)
48
+ debug('Migration statements executed')
49
+ return
50
+ }
51
+ case 'sqlite':
52
+ case 'expo':
53
+ case 'react-native': {
54
+ debug('using sqlite/react-native migration file')
55
+ const mig: CreateMachineStateStore1708796002272 = new CreateMachineStateStore1708796002272()
56
+ await mig.down(queryRunner)
57
+ debug('Migration statements executed')
58
+ return
59
+ }
60
+ default:
61
+ return Promise.reject(
62
+ `Migrations are currently only supported for sqlite, react-native, expo and postgres. Was ${dbType}. Please run your database without migrations and with 'migrationsRun: false' and 'synchronize: true' for now`,
63
+ )
64
+ }
65
+ }
66
+ }
@@ -1,36 +1,33 @@
1
- import { CreateContacts1659463079429 } from './1-CreateContacts'
2
- import { CreateIssuanceBranding1659463079429 } from './2-CreateIssuanceBranding'
3
- import { CreateContacts1690925872318 } from './3-CreateContacts'
4
- import { CreateStatusList1693866470000 } from './4-CreateStatusList'
5
- import { CreateAuditEvents1701635835330 } from './5-CreateAuditEvents'
6
- import { CreateDigitalCredential1708525189000 } from './6-CreateDigitalCredential'
7
- import { CreateMachineStateStore1708098041262 } from './7-CreateMachineStateStore'
8
- import { CreatePresentationDefinitions1716533767523 } from './8-CreatePresentationDefinitions'
9
-
10
- /**
11
- * The migrations array that SHOULD be used when initializing a TypeORM database connection.
12
- *
13
- * These ensure the correct creation of tables and the proper migrations of data when tables change between versions.
14
- *
15
- * @public
16
- */
17
-
18
- // Individual migrations per purpose. Allows parties to not run migrations and thus create/update tables if they are not using a particular feature (yet)
19
- export const DataStoreContactMigrations = [CreateContacts1659463079429, CreateContacts1690925872318]
20
- export const DataStoreIssuanceBrandingMigrations = [CreateIssuanceBranding1659463079429]
21
- export const DataStoreStatusListMigrations = [CreateStatusList1693866470000]
22
- export const DataStoreEventLoggerMigrations = [CreateAuditEvents1701635835330]
23
- export const DataStoreDigitalCredentialMigrations = [CreateDigitalCredential1708525189000]
24
- export const DataStoreMachineStateMigrations = [CreateMachineStateStore1708098041262]
25
- export const DataStorePresentationsDefinitionsMigrations = [CreatePresentationDefinitions1716533767523]
26
-
27
- // All migrations together
28
- export const DataStoreMigrations = [
29
- ...DataStoreContactMigrations,
30
- ...DataStoreIssuanceBrandingMigrations,
31
- ...DataStoreStatusListMigrations,
32
- ...DataStoreEventLoggerMigrations,
33
- ...DataStoreDigitalCredentialMigrations,
34
- ...DataStoreMachineStateMigrations,
35
- ...DataStorePresentationsDefinitionsMigrations
36
- ]
1
+ import { CreateContacts1659463079429 } from './1-CreateContacts'
2
+ import { CreateIssuanceBranding1659463079429 } from './2-CreateIssuanceBranding'
3
+ import { CreateContacts1690925872318 } from './3-CreateContacts'
4
+ import { CreateStatusList1693866470000 } from './4-CreateStatusList'
5
+ import { CreateAuditEvents1701635835330 } from './5-CreateAuditEvents'
6
+ import { CreateDigitalCredential1708525189000 } from './6-CreateDigitalCredential'
7
+ import { CreateMachineStateStore1708098041262 } from './7-CreateMachineStateStore'
8
+
9
+ /**
10
+ * The migrations array that SHOULD be used when initializing a TypeORM database connection.
11
+ *
12
+ * These ensure the correct creation of tables and the proper migrations of data when tables change between versions.
13
+ *
14
+ * @public
15
+ */
16
+
17
+ // Individual migrations per purpose. Allows parties to not run migrations and thus create/update tables if they are not using a particular feature (yet)
18
+ export const DataStoreContactMigrations = [CreateContacts1659463079429, CreateContacts1690925872318]
19
+ export const DataStoreIssuanceBrandingMigrations = [CreateIssuanceBranding1659463079429]
20
+ export const DataStoreStatusListMigrations = [CreateStatusList1693866470000]
21
+ export const DataStoreEventLoggerMigrations = [CreateAuditEvents1701635835330]
22
+ export const DataStoreDigitalCredentialMigrations = [CreateDigitalCredential1708525189000]
23
+ export const DataStoreMachineStateMigrations = [CreateMachineStateStore1708098041262]
24
+
25
+ // All migrations together
26
+ export const DataStoreMigrations = [
27
+ ...DataStoreContactMigrations,
28
+ ...DataStoreIssuanceBrandingMigrations,
29
+ ...DataStoreStatusListMigrations,
30
+ ...DataStoreEventLoggerMigrations,
31
+ ...DataStoreDigitalCredentialMigrations,
32
+ ...DataStoreMachineStateMigrations,
33
+ ]
@@ -1,10 +1,9 @@
1
- export {
2
- DataStoreMigrations,
3
- DataStoreEventLoggerMigrations,
4
- DataStoreContactMigrations,
5
- DataStoreIssuanceBrandingMigrations,
6
- DataStoreStatusListMigrations,
7
- DataStoreDigitalCredentialMigrations,
8
- DataStoreMachineStateMigrations,
9
- DataStorePresentationsDefinitionsMigrations
10
- } from './generic'
1
+ export {
2
+ DataStoreMigrations,
3
+ DataStoreEventLoggerMigrations,
4
+ DataStoreContactMigrations,
5
+ DataStoreIssuanceBrandingMigrations,
6
+ DataStoreStatusListMigrations,
7
+ DataStoreDigitalCredentialMigrations,
8
+ DataStoreMachineStateMigrations,
9
+ } from './generic'
@@ -1,63 +1,63 @@
1
- import { MigrationInterface, QueryRunner } from 'typeorm'
2
- import { enablePostgresUuidExtension } from '@sphereon/ssi-sdk.core'
3
-
4
- export class CreateContacts1659463079428 implements MigrationInterface {
5
- name = 'CreateContacts1659463079428'
6
-
7
- public async up(queryRunner: QueryRunner): Promise<void> {
8
- await enablePostgresUuidExtension(queryRunner)
9
- await queryRunner.query(
10
- `CREATE TABLE "BaseConfigEntity" ("id" uuid NOT NULL DEFAULT uuid_generate_v4(), "client_id" character varying(255), "client_secret" character varying(255), "scopes" text, "issuer" character varying(255), "redirect_url" text, "dangerously_allow_insecure_http_requests" boolean, "client_auth_method" text, "identifier" character varying(255), "session_id" character varying(255), "type" character varying NOT NULL, "connectionId" uuid, CONSTRAINT "REL_BaseConfig_connectionId" UNIQUE ("connectionId"), CONSTRAINT "PK_BaseConfigEntity_id" PRIMARY KEY ("id"))`,
11
- )
12
- await queryRunner.query(`CREATE INDEX "IDX_BaseConfigEntity_type" ON "BaseConfigEntity" ("type")`)
13
- await queryRunner.query(`CREATE TYPE "public"."CorrelationIdentifier_type_enum" AS ENUM('did', 'url')`)
14
- await queryRunner.query(
15
- `CREATE TABLE "CorrelationIdentifier" ("id" uuid NOT NULL DEFAULT uuid_generate_v4(), "type" "public"."CorrelationIdentifier_type_enum" NOT NULL, "correlation_id" text NOT NULL, "identityId" uuid, CONSTRAINT "UQ_Correlation_id" UNIQUE ("correlation_id"), CONSTRAINT "REL_CorrelationIdentifier_identityId" UNIQUE ("identityId"), CONSTRAINT "PK_CorrelationIdentifier_id" PRIMARY KEY ("id"))`,
16
- )
17
- await queryRunner.query(
18
- `CREATE TABLE "Contact" ("id" uuid NOT NULL DEFAULT uuid_generate_v4(), "name" character varying(255) NOT NULL, "alias" character varying(255) NOT NULL, "uri" character varying(255) NOT NULL, "created_at" TIMESTAMP NOT NULL DEFAULT now(), "last_updated_at" TIMESTAMP NOT NULL DEFAULT now(), CONSTRAINT "UQ_Name" UNIQUE ("name"), CONSTRAINT "UQ_Contact_Alias" UNIQUE ("alias"), CONSTRAINT "PK_Contact_id" PRIMARY KEY ("id"))`,
19
- )
20
- await queryRunner.query(
21
- `CREATE TABLE "IdentityMetadata" ("id" uuid NOT NULL DEFAULT uuid_generate_v4(), "label" character varying(255) NOT NULL, "value" character varying(255) NOT NULL, "identityId" uuid, CONSTRAINT "PK_IdentityMetadata_id" PRIMARY KEY ("id"))`,
22
- )
23
- await queryRunner.query(
24
- `CREATE TABLE "Identity" ("id" uuid NOT NULL DEFAULT uuid_generate_v4(), "alias" character varying(255) NOT NULL, "roles" text, "created_at" TIMESTAMP NOT NULL DEFAULT now(), "last_updated_at" TIMESTAMP NOT NULL DEFAULT now(), "contactId" uuid, CONSTRAINT "UQ_Identity_Alias" UNIQUE ("alias"), CONSTRAINT "PK_Identity_id" PRIMARY KEY ("id"))`,
25
- )
26
- await queryRunner.query(`CREATE TYPE "public"."Connection_type_enum" AS ENUM('OIDC', 'SIOPv2', 'SIOPv2+OpenID4VP')`)
27
- await queryRunner.query(
28
- `CREATE TABLE "Connection" ("id" uuid NOT NULL DEFAULT uuid_generate_v4(), "type" "public"."Connection_type_enum" NOT NULL, "identityId" uuid, CONSTRAINT "REL_Connection_identityId" UNIQUE ("identityId"), CONSTRAINT "PK_Connection_id" PRIMARY KEY ("id"))`,
29
- )
30
- await queryRunner.query(
31
- `ALTER TABLE "BaseConfigEntity" ADD CONSTRAINT "FK_BaseConfig_connectionId" FOREIGN KEY ("connectionId") REFERENCES "Connection"("id") ON DELETE CASCADE ON UPDATE NO ACTION`,
32
- )
33
- await queryRunner.query(
34
- `ALTER TABLE "CorrelationIdentifier" ADD CONSTRAINT "FK_CorrelationIdentifier_identityId" FOREIGN KEY ("identityId") REFERENCES "Identity"("id") ON DELETE CASCADE ON UPDATE NO ACTION`,
35
- )
36
- await queryRunner.query(
37
- `ALTER TABLE "IdentityMetadata" ADD CONSTRAINT "FK_IdentityMetadata_identityId" FOREIGN KEY ("identityId") REFERENCES "Identity"("id") ON DELETE CASCADE ON UPDATE NO ACTION`,
38
- )
39
- await queryRunner.query(
40
- `ALTER TABLE "Identity" ADD CONSTRAINT "FK_Identity_contactId" FOREIGN KEY ("contactId") REFERENCES "Contact"("id") ON DELETE CASCADE ON UPDATE NO ACTION`,
41
- )
42
- await queryRunner.query(
43
- `ALTER TABLE "Connection" ADD CONSTRAINT "FK_Connection_identityId" FOREIGN KEY ("identityId") REFERENCES "Identity"("id") ON DELETE CASCADE ON UPDATE NO ACTION`,
44
- )
45
- }
46
-
47
- public async down(queryRunner: QueryRunner): Promise<void> {
48
- await queryRunner.query(`ALTER TABLE "Connection" DROP CONSTRAINT "FK_Connection_identityId"`)
49
- await queryRunner.query(`ALTER TABLE "Identity" DROP CONSTRAINT "FK_Identity_contactId"`)
50
- await queryRunner.query(`ALTER TABLE "IdentityMetadata" DROP CONSTRAINT "FK_IdentityMetadata_identityId"`)
51
- await queryRunner.query(`ALTER TABLE "CorrelationIdentifier" DROP CONSTRAINT "FK_CorrelationIdentifier_identityId"`)
52
- await queryRunner.query(`ALTER TABLE "BaseConfigEntity" DROP CONSTRAINT "FK_BaseConfig_connectionId"`)
53
- await queryRunner.query(`DROP TABLE "Connection"`)
54
- await queryRunner.query(`DROP TYPE "public"."Connection_type_enum"`)
55
- await queryRunner.query(`DROP TABLE "Identity"`)
56
- await queryRunner.query(`DROP TABLE "IdentityMetadata"`)
57
- await queryRunner.query(`DROP TABLE "Contact"`)
58
- await queryRunner.query(`DROP TABLE "CorrelationIdentifier"`)
59
- await queryRunner.query(`DROP TYPE "public"."CorrelationIdentifier_type_enum"`)
60
- await queryRunner.query(`DROP INDEX "public"."IDX_BaseConfigEntity_type"`)
61
- await queryRunner.query(`DROP TABLE "BaseConfigEntity"`)
62
- }
63
- }
1
+ import { MigrationInterface, QueryRunner } from 'typeorm'
2
+ import { enablePostgresUuidExtension } from '@sphereon/ssi-sdk.core'
3
+
4
+ export class CreateContacts1659463079428 implements MigrationInterface {
5
+ name = 'CreateContacts1659463079428'
6
+
7
+ public async up(queryRunner: QueryRunner): Promise<void> {
8
+ await enablePostgresUuidExtension(queryRunner)
9
+ await queryRunner.query(
10
+ `CREATE TABLE "BaseConfigEntity" ("id" uuid NOT NULL DEFAULT uuid_generate_v4(), "client_id" character varying(255), "client_secret" character varying(255), "scopes" text, "issuer" character varying(255), "redirect_url" text, "dangerously_allow_insecure_http_requests" boolean, "client_auth_method" text, "identifier" character varying(255), "session_id" character varying(255), "type" character varying NOT NULL, "connectionId" uuid, CONSTRAINT "REL_BaseConfig_connectionId" UNIQUE ("connectionId"), CONSTRAINT "PK_BaseConfigEntity_id" PRIMARY KEY ("id"))`,
11
+ )
12
+ await queryRunner.query(`CREATE INDEX "IDX_BaseConfigEntity_type" ON "BaseConfigEntity" ("type")`)
13
+ await queryRunner.query(`CREATE TYPE "public"."CorrelationIdentifier_type_enum" AS ENUM('did', 'url')`)
14
+ await queryRunner.query(
15
+ `CREATE TABLE "CorrelationIdentifier" ("id" uuid NOT NULL DEFAULT uuid_generate_v4(), "type" "public"."CorrelationIdentifier_type_enum" NOT NULL, "correlation_id" text NOT NULL, "identityId" uuid, CONSTRAINT "UQ_Correlation_id" UNIQUE ("correlation_id"), CONSTRAINT "REL_CorrelationIdentifier_identityId" UNIQUE ("identityId"), CONSTRAINT "PK_CorrelationIdentifier_id" PRIMARY KEY ("id"))`,
16
+ )
17
+ await queryRunner.query(
18
+ `CREATE TABLE "Contact" ("id" uuid NOT NULL DEFAULT uuid_generate_v4(), "name" character varying(255) NOT NULL, "alias" character varying(255) NOT NULL, "uri" character varying(255) NOT NULL, "created_at" TIMESTAMP NOT NULL DEFAULT now(), "last_updated_at" TIMESTAMP NOT NULL DEFAULT now(), CONSTRAINT "UQ_Name" UNIQUE ("name"), CONSTRAINT "UQ_Contact_Alias" UNIQUE ("alias"), CONSTRAINT "PK_Contact_id" PRIMARY KEY ("id"))`,
19
+ )
20
+ await queryRunner.query(
21
+ `CREATE TABLE "IdentityMetadata" ("id" uuid NOT NULL DEFAULT uuid_generate_v4(), "label" character varying(255) NOT NULL, "value" character varying(255) NOT NULL, "identityId" uuid, CONSTRAINT "PK_IdentityMetadata_id" PRIMARY KEY ("id"))`,
22
+ )
23
+ await queryRunner.query(
24
+ `CREATE TABLE "Identity" ("id" uuid NOT NULL DEFAULT uuid_generate_v4(), "alias" character varying(255) NOT NULL, "roles" text, "created_at" TIMESTAMP NOT NULL DEFAULT now(), "last_updated_at" TIMESTAMP NOT NULL DEFAULT now(), "contactId" uuid, CONSTRAINT "UQ_Identity_Alias" UNIQUE ("alias"), CONSTRAINT "PK_Identity_id" PRIMARY KEY ("id"))`,
25
+ )
26
+ await queryRunner.query(`CREATE TYPE "public"."Connection_type_enum" AS ENUM('OIDC', 'SIOPv2', 'SIOPv2+OpenID4VP')`)
27
+ await queryRunner.query(
28
+ `CREATE TABLE "Connection" ("id" uuid NOT NULL DEFAULT uuid_generate_v4(), "type" "public"."Connection_type_enum" NOT NULL, "identityId" uuid, CONSTRAINT "REL_Connection_identityId" UNIQUE ("identityId"), CONSTRAINT "PK_Connection_id" PRIMARY KEY ("id"))`,
29
+ )
30
+ await queryRunner.query(
31
+ `ALTER TABLE "BaseConfigEntity" ADD CONSTRAINT "FK_BaseConfig_connectionId" FOREIGN KEY ("connectionId") REFERENCES "Connection"("id") ON DELETE CASCADE ON UPDATE NO ACTION`,
32
+ )
33
+ await queryRunner.query(
34
+ `ALTER TABLE "CorrelationIdentifier" ADD CONSTRAINT "FK_CorrelationIdentifier_identityId" FOREIGN KEY ("identityId") REFERENCES "Identity"("id") ON DELETE CASCADE ON UPDATE NO ACTION`,
35
+ )
36
+ await queryRunner.query(
37
+ `ALTER TABLE "IdentityMetadata" ADD CONSTRAINT "FK_IdentityMetadata_identityId" FOREIGN KEY ("identityId") REFERENCES "Identity"("id") ON DELETE CASCADE ON UPDATE NO ACTION`,
38
+ )
39
+ await queryRunner.query(
40
+ `ALTER TABLE "Identity" ADD CONSTRAINT "FK_Identity_contactId" FOREIGN KEY ("contactId") REFERENCES "Contact"("id") ON DELETE CASCADE ON UPDATE NO ACTION`,
41
+ )
42
+ await queryRunner.query(
43
+ `ALTER TABLE "Connection" ADD CONSTRAINT "FK_Connection_identityId" FOREIGN KEY ("identityId") REFERENCES "Identity"("id") ON DELETE CASCADE ON UPDATE NO ACTION`,
44
+ )
45
+ }
46
+
47
+ public async down(queryRunner: QueryRunner): Promise<void> {
48
+ await queryRunner.query(`ALTER TABLE "Connection" DROP CONSTRAINT "FK_Connection_identityId"`)
49
+ await queryRunner.query(`ALTER TABLE "Identity" DROP CONSTRAINT "FK_Identity_contactId"`)
50
+ await queryRunner.query(`ALTER TABLE "IdentityMetadata" DROP CONSTRAINT "FK_IdentityMetadata_identityId"`)
51
+ await queryRunner.query(`ALTER TABLE "CorrelationIdentifier" DROP CONSTRAINT "FK_CorrelationIdentifier_identityId"`)
52
+ await queryRunner.query(`ALTER TABLE "BaseConfigEntity" DROP CONSTRAINT "FK_BaseConfig_connectionId"`)
53
+ await queryRunner.query(`DROP TABLE "Connection"`)
54
+ await queryRunner.query(`DROP TYPE "public"."Connection_type_enum"`)
55
+ await queryRunner.query(`DROP TABLE "Identity"`)
56
+ await queryRunner.query(`DROP TABLE "IdentityMetadata"`)
57
+ await queryRunner.query(`DROP TABLE "Contact"`)
58
+ await queryRunner.query(`DROP TABLE "CorrelationIdentifier"`)
59
+ await queryRunner.query(`DROP TYPE "public"."CorrelationIdentifier_type_enum"`)
60
+ await queryRunner.query(`DROP INDEX "public"."IDX_BaseConfigEntity_type"`)
61
+ await queryRunner.query(`DROP TABLE "BaseConfigEntity"`)
62
+ }
63
+ }
@@ -1,85 +1,85 @@
1
- import { MigrationInterface, QueryRunner } from 'typeorm'
2
- import { enablePostgresUuidExtension } from '@sphereon/ssi-sdk.core'
3
-
4
- export class CreateIssuanceBranding1685628974232 implements MigrationInterface {
5
- name = 'CreateIssuanceBranding1685628974232'
6
-
7
- public async up(queryRunner: QueryRunner): Promise<void> {
8
- await enablePostgresUuidExtension(queryRunner)
9
- await queryRunner.query(
10
- `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"))`,
11
- )
12
- await queryRunner.query(
13
- `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"))`,
14
- )
15
- await queryRunner.query(
16
- `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"))`,
17
- )
18
- await queryRunner.query(
19
- `CREATE TABLE "TextAttributes" ("id" uuid NOT NULL DEFAULT uuid_generate_v4(), "color" character varying(255), CONSTRAINT "PK_TextAttributes_id" PRIMARY KEY ("id"))`,
20
- )
21
- await queryRunner.query(
22
- `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, CONSTRAINT "UQ_logoId" UNIQUE ("logoId"), CONSTRAINT "UQ_backgroundId" UNIQUE ("backgroundId"), CONSTRAINT "UQ_textId" UNIQUE ("textId"), CONSTRAINT "PK_BaseLocaleBranding_id" PRIMARY KEY ("id"))`,
23
- )
24
- await queryRunner.query(
25
- `CREATE UNIQUE INDEX "IDX_CredentialLocaleBrandingEntity_credentialBranding_locale" ON "BaseLocaleBranding" ("credentialBrandingId", "locale")`,
26
- )
27
- await queryRunner.query(
28
- `CREATE UNIQUE INDEX "IDX_IssuerLocaleBrandingEntity_issuerBranding_locale" ON "BaseLocaleBranding" ("issuerBrandingId", "locale")`,
29
- )
30
- await queryRunner.query(`CREATE INDEX "IDX_BaseLocaleBranding_type" ON "BaseLocaleBranding" ("type")`)
31
- await queryRunner.query(
32
- `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"))`,
33
- )
34
- await queryRunner.query(`CREATE INDEX "IDX_CredentialBrandingEntity_issuerCorrelationId" ON "CredentialBranding" ("issuerCorrelationId")`)
35
- await queryRunner.query(`CREATE INDEX "IDX_CredentialBrandingEntity_vcHash" ON "CredentialBranding" ("vcHash")`)
36
- await queryRunner.query(
37
- `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"))`,
38
- )
39
- await queryRunner.query(`CREATE INDEX "IDX_IssuerBrandingEntity_issuerCorrelationId" ON "IssuerBranding" ("issuerCorrelationId")`)
40
- await queryRunner.query(
41
- `ALTER TABLE "ImageAttributes" ADD CONSTRAINT "FK_ImageAttributes_dimensionsId" FOREIGN KEY ("dimensionsId") REFERENCES "ImageDimensions"("id") ON DELETE CASCADE ON UPDATE NO ACTION`,
42
- )
43
- await queryRunner.query(
44
- `ALTER TABLE "BackgroundAttributes" ADD CONSTRAINT "FK_BackgroundAttributes_imageId" FOREIGN KEY ("imageId") REFERENCES "ImageAttributes"("id") ON DELETE CASCADE ON UPDATE NO ACTION`,
45
- )
46
- await queryRunner.query(
47
- `ALTER TABLE "BaseLocaleBranding" ADD CONSTRAINT "FK_BaseLocaleBranding_logoId" FOREIGN KEY ("logoId") REFERENCES "ImageAttributes"("id") ON DELETE CASCADE ON UPDATE NO ACTION`,
48
- )
49
- await queryRunner.query(
50
- `ALTER TABLE "BaseLocaleBranding" ADD CONSTRAINT "FK_BaseLocaleBranding_backgroundId" FOREIGN KEY ("backgroundId") REFERENCES "BackgroundAttributes"("id") ON DELETE CASCADE ON UPDATE NO ACTION`,
51
- )
52
- await queryRunner.query(
53
- `ALTER TABLE "BaseLocaleBranding" ADD CONSTRAINT "FK_BaseLocaleBranding_textId" FOREIGN KEY ("textId") REFERENCES "TextAttributes"("id") ON DELETE CASCADE ON UPDATE NO ACTION`,
54
- )
55
- await queryRunner.query(
56
- `ALTER TABLE "BaseLocaleBranding" ADD CONSTRAINT "FK_BaseLocaleBranding_credentialBrandingId" FOREIGN KEY ("credentialBrandingId") REFERENCES "CredentialBranding"("id") ON DELETE CASCADE ON UPDATE NO ACTION`,
57
- )
58
- await queryRunner.query(
59
- `ALTER TABLE "BaseLocaleBranding" ADD CONSTRAINT "FK_BaseLocaleBranding_issuerBrandingId" FOREIGN KEY ("issuerBrandingId") REFERENCES "IssuerBranding"("id") ON DELETE CASCADE ON UPDATE NO ACTION`,
60
- )
61
- }
62
-
63
- public async down(queryRunner: QueryRunner): Promise<void> {
64
- await queryRunner.query(`ALTER TABLE "BaseLocaleBranding" DROP CONSTRAINT "FK_BaseLocaleBranding_issuerBrandingId"`)
65
- await queryRunner.query(`ALTER TABLE "BaseLocaleBranding" DROP CONSTRAINT "FK_BaseLocaleBranding_credentialBrandingId"`)
66
- await queryRunner.query(`ALTER TABLE "BaseLocaleBranding" DROP CONSTRAINT "FK_BaseLocaleBranding_textId"`)
67
- await queryRunner.query(`ALTER TABLE "BaseLocaleBranding" DROP CONSTRAINT "FK_BaseLocaleBranding_backgroundId"`)
68
- await queryRunner.query(`ALTER TABLE "BaseLocaleBranding" DROP CONSTRAINT "FK_BaseLocaleBranding_logoId"`)
69
- await queryRunner.query(`ALTER TABLE "BaseLocaleBranding" DROP CONSTRAINT "FK_BackgroundAttributes_imageId"`)
70
- await queryRunner.query(`ALTER TABLE "BaseLocaleBranding" DROP CONSTRAINT "FK_ImageAttributes_dimensionsId"`)
71
- await queryRunner.query(`ALTER TABLE "IssuerBranding" DROP INDEX "IDX_IssuerBrandingEntity_issuerCorrelationId"`)
72
- await queryRunner.query(`DROP TABLE "IssuerBranding"`)
73
- await queryRunner.query(`ALTER TABLE "CredentialBranding" DROP INDEX "IDX_CredentialBrandingEntity_vcHash"`)
74
- await queryRunner.query(`ALTER TABLE "CredentialBranding" DROP INDEX "IDX_CredentialBrandingEntity_issuerCorrelationId"`)
75
- await queryRunner.query(`DROP TABLE "CredentialBranding"`)
76
- await queryRunner.query(`ALTER TABLE "BaseLocaleBranding" DROP INDEX "IDX_BaseLocaleBranding_type"`)
77
- await queryRunner.query(`ALTER TABLE "BaseLocaleBranding" DROP INDEX "IDX_IssuerLocaleBrandingEntity_issuerBranding_locale"`)
78
- await queryRunner.query(`ALTER TABLE "BaseLocaleBranding" DROP INDEX "IDX_CredentialLocaleBrandingEntity_credentialBranding_locale"`)
79
- await queryRunner.query(`DROP TABLE "BaseLocaleBranding"`)
80
- await queryRunner.query(`DROP TABLE "TextAttributes"`)
81
- await queryRunner.query(`DROP TABLE "BackgroundAttributes"`)
82
- await queryRunner.query(`DROP TABLE "ImageAttributes"`)
83
- await queryRunner.query(`DROP TABLE "ImageDimensions"`)
84
- }
85
- }
1
+ import { MigrationInterface, QueryRunner } from 'typeorm'
2
+ import { enablePostgresUuidExtension } from '@sphereon/ssi-sdk.core'
3
+
4
+ export class CreateIssuanceBranding1685628974232 implements MigrationInterface {
5
+ name = 'CreateIssuanceBranding1685628974232'
6
+
7
+ public async up(queryRunner: QueryRunner): Promise<void> {
8
+ await enablePostgresUuidExtension(queryRunner)
9
+ await queryRunner.query(
10
+ `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"))`,
11
+ )
12
+ await queryRunner.query(
13
+ `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"))`,
14
+ )
15
+ await queryRunner.query(
16
+ `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"))`,
17
+ )
18
+ await queryRunner.query(
19
+ `CREATE TABLE "TextAttributes" ("id" uuid NOT NULL DEFAULT uuid_generate_v4(), "color" character varying(255), CONSTRAINT "PK_TextAttributes_id" PRIMARY KEY ("id"))`,
20
+ )
21
+ await queryRunner.query(
22
+ `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, CONSTRAINT "UQ_logoId" UNIQUE ("logoId"), CONSTRAINT "UQ_backgroundId" UNIQUE ("backgroundId"), CONSTRAINT "UQ_textId" UNIQUE ("textId"), CONSTRAINT "PK_BaseLocaleBranding_id" PRIMARY KEY ("id"))`,
23
+ )
24
+ await queryRunner.query(
25
+ `CREATE UNIQUE INDEX "IDX_CredentialLocaleBrandingEntity_credentialBranding_locale" ON "BaseLocaleBranding" ("credentialBrandingId", "locale")`,
26
+ )
27
+ await queryRunner.query(
28
+ `CREATE UNIQUE INDEX "IDX_IssuerLocaleBrandingEntity_issuerBranding_locale" ON "BaseLocaleBranding" ("issuerBrandingId", "locale")`,
29
+ )
30
+ await queryRunner.query(`CREATE INDEX "IDX_BaseLocaleBranding_type" ON "BaseLocaleBranding" ("type")`)
31
+ await queryRunner.query(
32
+ `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"))`,
33
+ )
34
+ await queryRunner.query(`CREATE INDEX "IDX_CredentialBrandingEntity_issuerCorrelationId" ON "CredentialBranding" ("issuerCorrelationId")`)
35
+ await queryRunner.query(`CREATE INDEX "IDX_CredentialBrandingEntity_vcHash" ON "CredentialBranding" ("vcHash")`)
36
+ await queryRunner.query(
37
+ `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"))`,
38
+ )
39
+ await queryRunner.query(`CREATE INDEX "IDX_IssuerBrandingEntity_issuerCorrelationId" ON "IssuerBranding" ("issuerCorrelationId")`)
40
+ await queryRunner.query(
41
+ `ALTER TABLE "ImageAttributes" ADD CONSTRAINT "FK_ImageAttributes_dimensionsId" FOREIGN KEY ("dimensionsId") REFERENCES "ImageDimensions"("id") ON DELETE CASCADE ON UPDATE NO ACTION`,
42
+ )
43
+ await queryRunner.query(
44
+ `ALTER TABLE "BackgroundAttributes" ADD CONSTRAINT "FK_BackgroundAttributes_imageId" FOREIGN KEY ("imageId") REFERENCES "ImageAttributes"("id") ON DELETE CASCADE ON UPDATE NO ACTION`,
45
+ )
46
+ await queryRunner.query(
47
+ `ALTER TABLE "BaseLocaleBranding" ADD CONSTRAINT "FK_BaseLocaleBranding_logoId" FOREIGN KEY ("logoId") REFERENCES "ImageAttributes"("id") ON DELETE CASCADE ON UPDATE NO ACTION`,
48
+ )
49
+ await queryRunner.query(
50
+ `ALTER TABLE "BaseLocaleBranding" ADD CONSTRAINT "FK_BaseLocaleBranding_backgroundId" FOREIGN KEY ("backgroundId") REFERENCES "BackgroundAttributes"("id") ON DELETE CASCADE ON UPDATE NO ACTION`,
51
+ )
52
+ await queryRunner.query(
53
+ `ALTER TABLE "BaseLocaleBranding" ADD CONSTRAINT "FK_BaseLocaleBranding_textId" FOREIGN KEY ("textId") REFERENCES "TextAttributes"("id") ON DELETE CASCADE ON UPDATE NO ACTION`,
54
+ )
55
+ await queryRunner.query(
56
+ `ALTER TABLE "BaseLocaleBranding" ADD CONSTRAINT "FK_BaseLocaleBranding_credentialBrandingId" FOREIGN KEY ("credentialBrandingId") REFERENCES "CredentialBranding"("id") ON DELETE CASCADE ON UPDATE NO ACTION`,
57
+ )
58
+ await queryRunner.query(
59
+ `ALTER TABLE "BaseLocaleBranding" ADD CONSTRAINT "FK_BaseLocaleBranding_issuerBrandingId" FOREIGN KEY ("issuerBrandingId") REFERENCES "IssuerBranding"("id") ON DELETE CASCADE ON UPDATE NO ACTION`,
60
+ )
61
+ }
62
+
63
+ public async down(queryRunner: QueryRunner): Promise<void> {
64
+ await queryRunner.query(`ALTER TABLE "BaseLocaleBranding" DROP CONSTRAINT "FK_BaseLocaleBranding_issuerBrandingId"`)
65
+ await queryRunner.query(`ALTER TABLE "BaseLocaleBranding" DROP CONSTRAINT "FK_BaseLocaleBranding_credentialBrandingId"`)
66
+ await queryRunner.query(`ALTER TABLE "BaseLocaleBranding" DROP CONSTRAINT "FK_BaseLocaleBranding_textId"`)
67
+ await queryRunner.query(`ALTER TABLE "BaseLocaleBranding" DROP CONSTRAINT "FK_BaseLocaleBranding_backgroundId"`)
68
+ await queryRunner.query(`ALTER TABLE "BaseLocaleBranding" DROP CONSTRAINT "FK_BaseLocaleBranding_logoId"`)
69
+ await queryRunner.query(`ALTER TABLE "BaseLocaleBranding" DROP CONSTRAINT "FK_BackgroundAttributes_imageId"`)
70
+ await queryRunner.query(`ALTER TABLE "BaseLocaleBranding" DROP CONSTRAINT "FK_ImageAttributes_dimensionsId"`)
71
+ await queryRunner.query(`ALTER TABLE "IssuerBranding" DROP INDEX "IDX_IssuerBrandingEntity_issuerCorrelationId"`)
72
+ await queryRunner.query(`DROP TABLE "IssuerBranding"`)
73
+ await queryRunner.query(`ALTER TABLE "CredentialBranding" DROP INDEX "IDX_CredentialBrandingEntity_vcHash"`)
74
+ await queryRunner.query(`ALTER TABLE "CredentialBranding" DROP INDEX "IDX_CredentialBrandingEntity_issuerCorrelationId"`)
75
+ await queryRunner.query(`DROP TABLE "CredentialBranding"`)
76
+ await queryRunner.query(`ALTER TABLE "BaseLocaleBranding" DROP INDEX "IDX_BaseLocaleBranding_type"`)
77
+ await queryRunner.query(`ALTER TABLE "BaseLocaleBranding" DROP INDEX "IDX_IssuerLocaleBrandingEntity_issuerBranding_locale"`)
78
+ await queryRunner.query(`ALTER TABLE "BaseLocaleBranding" DROP INDEX "IDX_CredentialLocaleBrandingEntity_credentialBranding_locale"`)
79
+ await queryRunner.query(`DROP TABLE "BaseLocaleBranding"`)
80
+ await queryRunner.query(`DROP TABLE "TextAttributes"`)
81
+ await queryRunner.query(`DROP TABLE "BackgroundAttributes"`)
82
+ await queryRunner.query(`DROP TABLE "ImageAttributes"`)
83
+ await queryRunner.query(`DROP TABLE "ImageDimensions"`)
84
+ }
85
+ }