@sphereon/ssi-sdk.data-store 0.30.1-unstable.4 → 0.30.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +201 -201
- package/README.md +77 -77
- package/dist/contact/ContactStore.d.ts.map +1 -1
- package/dist/digitalCredential/DigitalCredentialStore.d.ts.map +1 -1
- package/dist/eventLogger/EventLoggerStore.d.ts.map +1 -1
- package/dist/issuanceBranding/IssuanceBrandingStore.d.ts.map +1 -1
- package/dist/migrations/internal-migrations-ormconfig.d.ts.map +1 -1
- package/dist/migrations/postgres/1708525189001-CreateDigitalCredential.js +33 -33
- package/dist/migrations/postgres/1708797018115-CreateMachineStateStore.js +16 -16
- package/dist/migrations/postgres/1715761125001-CreateContacts.js +33 -33
- package/dist/migrations/postgres/1716475165345-CreatePresentationDefinitions.js +12 -12
- package/dist/migrations/sqlite/1708525189002-CreateDigitalCredential.js +32 -32
- package/dist/migrations/sqlite/1708796002272-CreateMachineStateStore.js +15 -15
- package/dist/migrations/sqlite/1710438363002-CreateContacts.js +13 -13
- package/dist/migrations/sqlite/1715761125002-CreateContacts.js +32 -32
- package/dist/migrations/sqlite/1716475165344-CreatePresentationDefinitions.js +9 -9
- package/dist/presentationDefinition/PDStore.d.ts.map +1 -1
- package/dist/utils/SortingUtils.d.ts.map +1 -1
- package/dist/utils/contact/MappingUtils.d.ts.map +1 -1
- package/dist/utils/digitalCredential/MappingUtils.d.ts.map +1 -1
- package/dist/utils/digitalCredential/MappingUtils.js +4 -4
- package/dist/utils/digitalCredential/MappingUtils.js.map +1 -1
- package/dist/utils/presentationDefinition/MappingUtils.js +2 -2
- package/dist/utils/presentationDefinition/MappingUtils.js.map +1 -1
- package/package.json +8 -8
- package/src/__tests__/contact.entities.test.ts +2642 -2642
- package/src/__tests__/contact.store.test.ts +2649 -2649
- package/src/__tests__/digitalCredential.entities.test.ts +274 -274
- package/src/__tests__/digitalCredential.store.test.ts +330 -330
- package/src/__tests__/eventLogger.entities.test.ts +76 -76
- package/src/__tests__/eventLogger.store.test.ts +130 -130
- package/src/__tests__/issuanceBranding.entities.test.ts +846 -846
- package/src/__tests__/issuanceBranding.store.test.ts +1886 -1886
- package/src/__tests__/machineState.entities.test.ts +53 -53
- package/src/__tests__/machineState.store.test.ts +176 -176
- package/src/__tests__/pd-manager.entities.test.ts +73 -73
- package/src/__tests__/pd-manager.store.test.ts +193 -193
- package/src/contact/AbstractContactStore.ts +71 -71
- package/src/contact/ContactStore.ts +768 -768
- package/src/digitalCredential/AbstractDigitalCredentialStore.ts +21 -21
- package/src/digitalCredential/DigitalCredentialStore.ts +189 -189
- package/src/entities/contact/BaseContactEntity.ts +51 -51
- package/src/entities/contact/ConnectionEntity.ts +35 -35
- package/src/entities/contact/ContactMetadataItemEntity.ts +51 -51
- package/src/entities/contact/CorrelationIdentifierEntity.ts +43 -43
- package/src/entities/contact/DidAuthConfigEntity.ts +20 -20
- package/src/entities/contact/ElectronicAddressEntity.ts +70 -70
- package/src/entities/contact/IdentityEntity.ts +107 -107
- package/src/entities/contact/IdentityMetadataItemEntity.ts +48 -48
- package/src/entities/contact/NaturalPersonEntity.ts +44 -44
- package/src/entities/contact/OpenIdConfigEntity.ts +32 -32
- package/src/entities/contact/OrganizationEntity.ts +35 -35
- package/src/entities/contact/PartyEntity.ts +117 -117
- package/src/entities/contact/PartyRelationshipEntity.ts +68 -68
- package/src/entities/contact/PartyTypeEntity.ts +63 -63
- package/src/entities/contact/PhysicalAddressEntity.ts +95 -95
- package/src/entities/digitalCredential/DigitalCredentialEntity.ts +98 -98
- package/src/entities/eventLogger/AuditEventEntity.ts +92 -92
- package/src/entities/issuanceBranding/BackgroundAttributesEntity.ts +42 -42
- package/src/entities/issuanceBranding/BaseLocaleBrandingEntity.ts +87 -87
- package/src/entities/issuanceBranding/CredentialBrandingEntity.ts +79 -79
- package/src/entities/issuanceBranding/CredentialLocaleBrandingEntity.ts +33 -33
- package/src/entities/issuanceBranding/ImageAttributesEntity.ts +57 -57
- package/src/entities/issuanceBranding/ImageDimensionsEntity.ts +22 -22
- package/src/entities/issuanceBranding/IssuerBrandingEntity.ts +73 -73
- package/src/entities/issuanceBranding/IssuerLocaleBrandingEntity.ts +33 -33
- package/src/entities/issuanceBranding/TextAttributesEntity.ts +31 -31
- package/src/entities/machineState/MachineStateInfoEntity.ts +59 -59
- package/src/entities/presentationDefinition/PresentationDefinitionItemEntity.ts +44 -44
- package/src/entities/statusList2021/StatusList2021Entity.ts +96 -96
- package/src/entities/statusList2021/StatusList2021EntryEntity.ts +29 -29
- package/src/eventLogger/AbstractEventLoggerStore.ts +7 -7
- package/src/eventLogger/EventLoggerStore.ts +62 -62
- package/src/index.ts +160 -160
- package/src/issuanceBranding/IssuanceBrandingStore.ts +559 -559
- package/src/machineState/IAbstractMachineStateStore.ts +65 -65
- package/src/machineState/MachineStateStore.ts +149 -149
- package/src/migrations/generic/1-CreateContacts.ts +66 -66
- package/src/migrations/generic/10-CreatePresentationDefinitions.ts +66 -66
- package/src/migrations/generic/2-CreateIssuanceBranding.ts +64 -64
- package/src/migrations/generic/3-CreateContacts.ts +66 -66
- package/src/migrations/generic/4-CreateStatusList.ts +54 -54
- package/src/migrations/generic/5-CreateAuditEvents.ts +66 -66
- package/src/migrations/generic/6-CreateDigitalCredential.ts +66 -66
- package/src/migrations/generic/7-CreateMachineStateStore.ts +66 -66
- package/src/migrations/generic/8-CreateContacts.ts +66 -66
- package/src/migrations/generic/9-CreateContacts.ts +66 -66
- package/src/migrations/generic/index.ts +43 -43
- package/src/migrations/index.ts +10 -10
- package/src/migrations/postgres/1659463079428-CreateContacts.ts +63 -63
- package/src/migrations/postgres/1685628974232-CreateIssuanceBranding.ts +85 -85
- package/src/migrations/postgres/1690925872592-CreateContacts.ts +158 -158
- package/src/migrations/postgres/1693866470001-CreateStatusList.ts +24 -24
- package/src/migrations/postgres/1701634812183-CreateAuditEvents.ts +33 -33
- package/src/migrations/postgres/1708525189001-CreateDigitalCredential.ts +61 -61
- package/src/migrations/postgres/1708797018115-CreateMachineStateStore.ts +29 -29
- package/src/migrations/postgres/1710438363001-CreateContacts.ts +63 -63
- package/src/migrations/postgres/1715761125001-CreateContacts.ts +60 -60
- package/src/migrations/postgres/1716475165345-CreatePresentationDefinitions.ts +25 -25
- package/src/migrations/sqlite/1659463069549-CreateContacts.ts +110 -110
- package/src/migrations/sqlite/1685628973231-CreateIssuanceBranding.ts +119 -119
- package/src/migrations/sqlite/1690925872693-CreateContacts.ts +228 -228
- package/src/migrations/sqlite/1693866470000-CreateStatusList.ts +24 -24
- package/src/migrations/sqlite/1701634819487-CreateAuditEvents.ts +15 -15
- package/src/migrations/sqlite/1708525189002-CreateDigitalCredential.ts +46 -46
- package/src/migrations/sqlite/1708796002272-CreateMachineStateStore.ts +28 -28
- package/src/migrations/sqlite/1710438363002-CreateContacts.ts +83 -83
- package/src/migrations/sqlite/1715761125002-CreateContacts.ts +59 -59
- package/src/migrations/sqlite/1716475165344-CreatePresentationDefinitions.ts +24 -24
- package/src/presentationDefinition/AbstractPDStore.ts +20 -20
- package/src/presentationDefinition/PDStore.ts +185 -185
- package/src/statusList/IStatusListStore.ts +44 -44
- package/src/statusList/StatusListStore.ts +236 -236
- package/src/types/contact/IAbstractContactStore.ts +161 -161
- package/src/types/contact/contact.ts +295 -295
- package/src/types/digitalCredential/IAbstractDigitalCredentialStore.ts +42 -42
- package/src/types/digitalCredential/digitalCredential.ts +102 -102
- package/src/types/eventLogger/IAbstractEventLoggerStore.ts +12 -12
- package/src/types/eventLogger/eventLogger.ts +3 -3
- package/src/types/index.ts +14 -14
- package/src/types/machineState/IAbstractMachineStateStore.ts +68 -68
- package/src/types/presentationDefinition/IAbstractPDStore.ts +25 -25
- package/src/types/presentationDefinition/presentationDefinition.ts +17 -17
- package/src/utils/SortingUtils.ts +16 -16
- package/src/utils/contact/MappingUtils.ts +506 -506
- package/src/utils/digitalCredential/MappingUtils.ts +160 -160
- package/src/utils/hasher.ts +19 -19
- package/src/utils/presentationDefinition/MappingUtils.ts +52 -52
- package/dist/entities/contact/IMetadataEntity.d.ts +0 -8
- package/dist/entities/contact/IMetadataEntity.d.ts.map +0 -1
- package/dist/entities/contact/IMetadataEntity.js +0 -2
- package/dist/entities/contact/IMetadataEntity.js.map +0 -1
- package/dist/migrations/generic/8-CreatePresentationDefinitions.d.ts +0 -7
- package/dist/migrations/generic/8-CreatePresentationDefinitions.d.ts.map +0 -1
- package/dist/migrations/generic/8-CreatePresentationDefinitions.js +0 -78
- package/dist/migrations/generic/8-CreatePresentationDefinitions.js.map +0 -1
|
@@ -1,29 +1,29 @@
|
|
|
1
|
-
import { MigrationInterface, QueryRunner } from 'typeorm'
|
|
2
|
-
|
|
3
|
-
export class CreateMachineStateStore1708797018115 implements MigrationInterface {
|
|
4
|
-
name = 'CreateMachineStateStore1708797018115'
|
|
5
|
-
|
|
6
|
-
public async up(queryRunner: QueryRunner): Promise<void> {
|
|
7
|
-
await queryRunner.query(`
|
|
8
|
-
CREATE TABLE "MachineStateInfoEntity" (
|
|
9
|
-
"instance_id" text NOT NULL,
|
|
10
|
-
"session_id" text,
|
|
11
|
-
"latest_state_name" text,
|
|
12
|
-
"machine_name" text NOT NULL,
|
|
13
|
-
"latest_event_type" text NOT NULL,
|
|
14
|
-
"state" text NOT NULL,
|
|
15
|
-
"created_at" TIMESTAMP NOT NULL DEFAULT now(),
|
|
16
|
-
"updated_at" TIMESTAMP NOT NULL DEFAULT now(),
|
|
17
|
-
"updated_count" integer NOT NULL DEFAULT 0,
|
|
18
|
-
"expires_at" TIMESTAMP,
|
|
19
|
-
"completed_at" TIMESTAMP,
|
|
20
|
-
"tenant_id" text,
|
|
21
|
-
CONSTRAINT "PK_MachineStateInfoEntity_id" PRIMARY KEY ("instance_id")
|
|
22
|
-
)
|
|
23
|
-
`)
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
public async down(queryRunner: QueryRunner): Promise<void> {
|
|
27
|
-
await queryRunner.query(`DROP TABLE "MachineStateInfoEntity"`)
|
|
28
|
-
}
|
|
29
|
-
}
|
|
1
|
+
import { MigrationInterface, QueryRunner } from 'typeorm'
|
|
2
|
+
|
|
3
|
+
export class CreateMachineStateStore1708797018115 implements MigrationInterface {
|
|
4
|
+
name = 'CreateMachineStateStore1708797018115'
|
|
5
|
+
|
|
6
|
+
public async up(queryRunner: QueryRunner): Promise<void> {
|
|
7
|
+
await queryRunner.query(`
|
|
8
|
+
CREATE TABLE "MachineStateInfoEntity" (
|
|
9
|
+
"instance_id" text NOT NULL,
|
|
10
|
+
"session_id" text,
|
|
11
|
+
"latest_state_name" text,
|
|
12
|
+
"machine_name" text NOT NULL,
|
|
13
|
+
"latest_event_type" text NOT NULL,
|
|
14
|
+
"state" text NOT NULL,
|
|
15
|
+
"created_at" TIMESTAMP NOT NULL DEFAULT now(),
|
|
16
|
+
"updated_at" TIMESTAMP NOT NULL DEFAULT now(),
|
|
17
|
+
"updated_count" integer NOT NULL DEFAULT 0,
|
|
18
|
+
"expires_at" TIMESTAMP,
|
|
19
|
+
"completed_at" TIMESTAMP,
|
|
20
|
+
"tenant_id" text,
|
|
21
|
+
CONSTRAINT "PK_MachineStateInfoEntity_id" PRIMARY KEY ("instance_id")
|
|
22
|
+
)
|
|
23
|
+
`)
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
public async down(queryRunner: QueryRunner): Promise<void> {
|
|
27
|
+
await queryRunner.query(`DROP TABLE "MachineStateInfoEntity"`)
|
|
28
|
+
}
|
|
29
|
+
}
|
|
@@ -1,63 +1,63 @@
|
|
|
1
|
-
import { MigrationInterface, QueryRunner } from 'typeorm'
|
|
2
|
-
|
|
3
|
-
export class CreateContacts1710438363001 implements MigrationInterface {
|
|
4
|
-
name = 'CreateContacts1710438363001'
|
|
5
|
-
|
|
6
|
-
public async up(queryRunner: QueryRunner): Promise<void> {
|
|
7
|
-
await queryRunner.query(`ALTER TABLE "Party" ADD COLUMN "owner_id" uuid`)
|
|
8
|
-
await queryRunner.query(`ALTER TABLE "Party" ADD COLUMN "tenant_id" uuid`)
|
|
9
|
-
|
|
10
|
-
await queryRunner.query(`ALTER TABLE "Identity" ADD COLUMN "owner_id" uuid`)
|
|
11
|
-
await queryRunner.query(`ALTER TABLE "Identity" ADD COLUMN "tenant_id" uuid`)
|
|
12
|
-
|
|
13
|
-
await queryRunner.query(`ALTER TABLE "CorrelationIdentifier" ADD COLUMN "owner_id" uuid`)
|
|
14
|
-
await queryRunner.query(`ALTER TABLE "CorrelationIdentifier" ADD COLUMN "tenant_id" uuid`)
|
|
15
|
-
|
|
16
|
-
await queryRunner.query(`ALTER TABLE "Connection" ADD COLUMN "owner_id" uuid`)
|
|
17
|
-
await queryRunner.query(`ALTER TABLE "Connection" ADD COLUMN "tenant_id" uuid`)
|
|
18
|
-
|
|
19
|
-
await queryRunner.query(`ALTER TABLE "BaseConfig" ADD COLUMN "owner_id" uuid`)
|
|
20
|
-
await queryRunner.query(`ALTER TABLE "BaseConfig" ADD COLUMN "tenant_id" uuid`)
|
|
21
|
-
|
|
22
|
-
await queryRunner.query(`ALTER TABLE "BaseContact" ADD COLUMN "owner_id" uuid`)
|
|
23
|
-
await queryRunner.query(`ALTER TABLE "BaseContact" ADD COLUMN "tenant_id" uuid`)
|
|
24
|
-
|
|
25
|
-
await queryRunner.query(`ALTER TABLE "PartyRelationship" ADD COLUMN "owner_id" uuid`)
|
|
26
|
-
await queryRunner.query(`ALTER TABLE "PartyRelationship" ADD COLUMN "tenant_id" uuid`)
|
|
27
|
-
|
|
28
|
-
await queryRunner.query(`ALTER TABLE "ElectronicAddress" ADD COLUMN "owner_id" uuid`)
|
|
29
|
-
await queryRunner.query(`ALTER TABLE "ElectronicAddress" ADD COLUMN "tenant_id" uuid`)
|
|
30
|
-
|
|
31
|
-
await queryRunner.query(`ALTER TABLE "PhysicalAddress" ADD COLUMN "owner_id" uuid`)
|
|
32
|
-
await queryRunner.query(`ALTER TABLE "PhysicalAddress" ADD COLUMN "tenant_id" uuid`)
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
public async down(queryRunner: QueryRunner): Promise<void> {
|
|
36
|
-
await queryRunner.query(`ALTER TABLE "PhysicalAddress" DROP COLUMN "tenant_id"`)
|
|
37
|
-
await queryRunner.query(`ALTER TABLE "PhysicalAddress" DROP COLUMN "owner_id"`)
|
|
38
|
-
|
|
39
|
-
await queryRunner.query(`ALTER TABLE "ElectronicAddress" DROP COLUMN "tenant_id"`)
|
|
40
|
-
await queryRunner.query(`ALTER TABLE "ElectronicAddress" DROP COLUMN "owner_id"`)
|
|
41
|
-
|
|
42
|
-
await queryRunner.query(`ALTER TABLE "PartyRelationship" DROP COLUMN "tenant_id"`)
|
|
43
|
-
await queryRunner.query(`ALTER TABLE "PartyRelationship" DROP COLUMN "owner_id"`)
|
|
44
|
-
|
|
45
|
-
await queryRunner.query(`ALTER TABLE "BaseContact" DROP COLUMN "tenant_id"`)
|
|
46
|
-
await queryRunner.query(`ALTER TABLE "BaseContact" DROP COLUMN "owner_id"`)
|
|
47
|
-
|
|
48
|
-
await queryRunner.query(`ALTER TABLE "BaseConfig" DROP COLUMN "tenant_id"`)
|
|
49
|
-
await queryRunner.query(`ALTER TABLE "BaseConfig" DROP COLUMN "owner_id"`)
|
|
50
|
-
|
|
51
|
-
await queryRunner.query(`ALTER TABLE "Connection" DROP COLUMN "tenant_id"`)
|
|
52
|
-
await queryRunner.query(`ALTER TABLE "Connection" DROP COLUMN "owner_id"`)
|
|
53
|
-
|
|
54
|
-
await queryRunner.query(`ALTER TABLE "CorrelationIdentifier" DROP COLUMN "tenant_id"`)
|
|
55
|
-
await queryRunner.query(`ALTER TABLE "CorrelationIdentifier" DROP COLUMN "owner_id"`)
|
|
56
|
-
|
|
57
|
-
await queryRunner.query(`ALTER TABLE "Identity" DROP COLUMN "tenant_id"`)
|
|
58
|
-
await queryRunner.query(`ALTER TABLE "Identity" DROP COLUMN "owner_id"`)
|
|
59
|
-
|
|
60
|
-
await queryRunner.query(`ALTER TABLE "Party" DROP COLUMN "tenant_id"`)
|
|
61
|
-
await queryRunner.query(`ALTER TABLE "Party" DROP COLUMN "owner_id"`)
|
|
62
|
-
}
|
|
63
|
-
}
|
|
1
|
+
import { MigrationInterface, QueryRunner } from 'typeorm'
|
|
2
|
+
|
|
3
|
+
export class CreateContacts1710438363001 implements MigrationInterface {
|
|
4
|
+
name = 'CreateContacts1710438363001'
|
|
5
|
+
|
|
6
|
+
public async up(queryRunner: QueryRunner): Promise<void> {
|
|
7
|
+
await queryRunner.query(`ALTER TABLE "Party" ADD COLUMN "owner_id" uuid`)
|
|
8
|
+
await queryRunner.query(`ALTER TABLE "Party" ADD COLUMN "tenant_id" uuid`)
|
|
9
|
+
|
|
10
|
+
await queryRunner.query(`ALTER TABLE "Identity" ADD COLUMN "owner_id" uuid`)
|
|
11
|
+
await queryRunner.query(`ALTER TABLE "Identity" ADD COLUMN "tenant_id" uuid`)
|
|
12
|
+
|
|
13
|
+
await queryRunner.query(`ALTER TABLE "CorrelationIdentifier" ADD COLUMN "owner_id" uuid`)
|
|
14
|
+
await queryRunner.query(`ALTER TABLE "CorrelationIdentifier" ADD COLUMN "tenant_id" uuid`)
|
|
15
|
+
|
|
16
|
+
await queryRunner.query(`ALTER TABLE "Connection" ADD COLUMN "owner_id" uuid`)
|
|
17
|
+
await queryRunner.query(`ALTER TABLE "Connection" ADD COLUMN "tenant_id" uuid`)
|
|
18
|
+
|
|
19
|
+
await queryRunner.query(`ALTER TABLE "BaseConfig" ADD COLUMN "owner_id" uuid`)
|
|
20
|
+
await queryRunner.query(`ALTER TABLE "BaseConfig" ADD COLUMN "tenant_id" uuid`)
|
|
21
|
+
|
|
22
|
+
await queryRunner.query(`ALTER TABLE "BaseContact" ADD COLUMN "owner_id" uuid`)
|
|
23
|
+
await queryRunner.query(`ALTER TABLE "BaseContact" ADD COLUMN "tenant_id" uuid`)
|
|
24
|
+
|
|
25
|
+
await queryRunner.query(`ALTER TABLE "PartyRelationship" ADD COLUMN "owner_id" uuid`)
|
|
26
|
+
await queryRunner.query(`ALTER TABLE "PartyRelationship" ADD COLUMN "tenant_id" uuid`)
|
|
27
|
+
|
|
28
|
+
await queryRunner.query(`ALTER TABLE "ElectronicAddress" ADD COLUMN "owner_id" uuid`)
|
|
29
|
+
await queryRunner.query(`ALTER TABLE "ElectronicAddress" ADD COLUMN "tenant_id" uuid`)
|
|
30
|
+
|
|
31
|
+
await queryRunner.query(`ALTER TABLE "PhysicalAddress" ADD COLUMN "owner_id" uuid`)
|
|
32
|
+
await queryRunner.query(`ALTER TABLE "PhysicalAddress" ADD COLUMN "tenant_id" uuid`)
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
public async down(queryRunner: QueryRunner): Promise<void> {
|
|
36
|
+
await queryRunner.query(`ALTER TABLE "PhysicalAddress" DROP COLUMN "tenant_id"`)
|
|
37
|
+
await queryRunner.query(`ALTER TABLE "PhysicalAddress" DROP COLUMN "owner_id"`)
|
|
38
|
+
|
|
39
|
+
await queryRunner.query(`ALTER TABLE "ElectronicAddress" DROP COLUMN "tenant_id"`)
|
|
40
|
+
await queryRunner.query(`ALTER TABLE "ElectronicAddress" DROP COLUMN "owner_id"`)
|
|
41
|
+
|
|
42
|
+
await queryRunner.query(`ALTER TABLE "PartyRelationship" DROP COLUMN "tenant_id"`)
|
|
43
|
+
await queryRunner.query(`ALTER TABLE "PartyRelationship" DROP COLUMN "owner_id"`)
|
|
44
|
+
|
|
45
|
+
await queryRunner.query(`ALTER TABLE "BaseContact" DROP COLUMN "tenant_id"`)
|
|
46
|
+
await queryRunner.query(`ALTER TABLE "BaseContact" DROP COLUMN "owner_id"`)
|
|
47
|
+
|
|
48
|
+
await queryRunner.query(`ALTER TABLE "BaseConfig" DROP COLUMN "tenant_id"`)
|
|
49
|
+
await queryRunner.query(`ALTER TABLE "BaseConfig" DROP COLUMN "owner_id"`)
|
|
50
|
+
|
|
51
|
+
await queryRunner.query(`ALTER TABLE "Connection" DROP COLUMN "tenant_id"`)
|
|
52
|
+
await queryRunner.query(`ALTER TABLE "Connection" DROP COLUMN "owner_id"`)
|
|
53
|
+
|
|
54
|
+
await queryRunner.query(`ALTER TABLE "CorrelationIdentifier" DROP COLUMN "tenant_id"`)
|
|
55
|
+
await queryRunner.query(`ALTER TABLE "CorrelationIdentifier" DROP COLUMN "owner_id"`)
|
|
56
|
+
|
|
57
|
+
await queryRunner.query(`ALTER TABLE "Identity" DROP COLUMN "tenant_id"`)
|
|
58
|
+
await queryRunner.query(`ALTER TABLE "Identity" DROP COLUMN "owner_id"`)
|
|
59
|
+
|
|
60
|
+
await queryRunner.query(`ALTER TABLE "Party" DROP COLUMN "tenant_id"`)
|
|
61
|
+
await queryRunner.query(`ALTER TABLE "Party" DROP COLUMN "owner_id"`)
|
|
62
|
+
}
|
|
63
|
+
}
|
|
@@ -1,60 +1,60 @@
|
|
|
1
|
-
import { MigrationInterface, QueryRunner } from 'typeorm'
|
|
2
|
-
|
|
3
|
-
export class CreateContacts1715761125001 implements MigrationInterface {
|
|
4
|
-
name = 'CreateContacts1715761125001'
|
|
5
|
-
|
|
6
|
-
public async up(queryRunner: QueryRunner): Promise<void> {
|
|
7
|
-
// Upgrade IdentityMetadata table
|
|
8
|
-
await queryRunner.query(`ALTER TABLE "IdentityMetadata" RENAME TO "temporary_IdentityMetadata"`)
|
|
9
|
-
await queryRunner.query(`CREATE TABLE "IdentityMetadata"
|
|
10
|
-
(
|
|
11
|
-
"id" uuid PRIMARY KEY NOT NULL DEFAULT uuid_generate_v4(),
|
|
12
|
-
"label" character varying(255) NOT NULL,
|
|
13
|
-
"valueType" character varying NOT NULL,
|
|
14
|
-
"stringValue" text,
|
|
15
|
-
"numberValue" double precision,
|
|
16
|
-
"dateValue" TIMESTAMP,
|
|
17
|
-
"boolValue" boolean,
|
|
18
|
-
"identityId" uuid,
|
|
19
|
-
CONSTRAINT "FK_Identity_IdentityMetadata" FOREIGN KEY ("identityId") REFERENCES "Identity" ("id") ON DELETE CASCADE
|
|
20
|
-
)`)
|
|
21
|
-
await queryRunner.query(`INSERT INTO "IdentityMetadata" ("id", "label", "valueType", "stringValue", "identityId")
|
|
22
|
-
SELECT "id", "label", 'string', "value", "identityId"
|
|
23
|
-
FROM "temporary_IdentityMetadata"`)
|
|
24
|
-
await queryRunner.query(`DROP TABLE "temporary_IdentityMetadata"`)
|
|
25
|
-
|
|
26
|
-
// Create new ContactMetadata table
|
|
27
|
-
await queryRunner.query(`CREATE TABLE "ContactMetadata"
|
|
28
|
-
(
|
|
29
|
-
"id" uuid PRIMARY KEY NOT NULL DEFAULT uuid_generate_v4(),
|
|
30
|
-
"label" character varying(255) NOT NULL,
|
|
31
|
-
"valueType" character varying NOT NULL,
|
|
32
|
-
"stringValue" text,
|
|
33
|
-
"numberValue" double precision,
|
|
34
|
-
"dateValue" TIMESTAMP,
|
|
35
|
-
"boolValue" boolean,
|
|
36
|
-
"contactId" uuid,
|
|
37
|
-
CONSTRAINT "FK_BaseContact_ContactMetadata" FOREIGN KEY ("contactId") REFERENCES "BaseContact" ("id") ON DELETE CASCADE
|
|
38
|
-
)`)
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
public async down(queryRunner: QueryRunner): Promise<void> {
|
|
42
|
-
// Drop the ContactMetadata table
|
|
43
|
-
await queryRunner.query(`DROP TABLE "ContactMetadata"`)
|
|
44
|
-
|
|
45
|
-
// Restore the IdentityMetadata table
|
|
46
|
-
await queryRunner.query(`ALTER TABLE "IdentityMetadata" RENAME TO "temporary_IdentityMetadata"`)
|
|
47
|
-
await queryRunner.query(`CREATE TABLE "IdentityMetadata"
|
|
48
|
-
(
|
|
49
|
-
"id" uuid PRIMARY KEY NOT NULL DEFAULT uuid_generate_v4(),
|
|
50
|
-
"label" character varying(255) NOT NULL,
|
|
51
|
-
"value" character varying(255) NOT NULL,
|
|
52
|
-
"identityId" uuid,
|
|
53
|
-
CONSTRAINT "FK_Identity_IdentityMetadata" FOREIGN KEY ("identityId") REFERENCES "Identity" ("id") ON DELETE CASCADE
|
|
54
|
-
)`)
|
|
55
|
-
await queryRunner.query(`INSERT INTO "IdentityMetadata" ("id", "label", "value", "identityId")
|
|
56
|
-
SELECT "id", "label", "stringValue", "identityId"
|
|
57
|
-
FROM "temporary_IdentityMetadata"`)
|
|
58
|
-
await queryRunner.query(`DROP TABLE "temporary_IdentityMetadata"`)
|
|
59
|
-
}
|
|
60
|
-
}
|
|
1
|
+
import { MigrationInterface, QueryRunner } from 'typeorm'
|
|
2
|
+
|
|
3
|
+
export class CreateContacts1715761125001 implements MigrationInterface {
|
|
4
|
+
name = 'CreateContacts1715761125001'
|
|
5
|
+
|
|
6
|
+
public async up(queryRunner: QueryRunner): Promise<void> {
|
|
7
|
+
// Upgrade IdentityMetadata table
|
|
8
|
+
await queryRunner.query(`ALTER TABLE "IdentityMetadata" RENAME TO "temporary_IdentityMetadata"`)
|
|
9
|
+
await queryRunner.query(`CREATE TABLE "IdentityMetadata"
|
|
10
|
+
(
|
|
11
|
+
"id" uuid PRIMARY KEY NOT NULL DEFAULT uuid_generate_v4(),
|
|
12
|
+
"label" character varying(255) NOT NULL,
|
|
13
|
+
"valueType" character varying NOT NULL,
|
|
14
|
+
"stringValue" text,
|
|
15
|
+
"numberValue" double precision,
|
|
16
|
+
"dateValue" TIMESTAMP,
|
|
17
|
+
"boolValue" boolean,
|
|
18
|
+
"identityId" uuid,
|
|
19
|
+
CONSTRAINT "FK_Identity_IdentityMetadata" FOREIGN KEY ("identityId") REFERENCES "Identity" ("id") ON DELETE CASCADE
|
|
20
|
+
)`)
|
|
21
|
+
await queryRunner.query(`INSERT INTO "IdentityMetadata" ("id", "label", "valueType", "stringValue", "identityId")
|
|
22
|
+
SELECT "id", "label", 'string', "value", "identityId"
|
|
23
|
+
FROM "temporary_IdentityMetadata"`)
|
|
24
|
+
await queryRunner.query(`DROP TABLE "temporary_IdentityMetadata"`)
|
|
25
|
+
|
|
26
|
+
// Create new ContactMetadata table
|
|
27
|
+
await queryRunner.query(`CREATE TABLE "ContactMetadata"
|
|
28
|
+
(
|
|
29
|
+
"id" uuid PRIMARY KEY NOT NULL DEFAULT uuid_generate_v4(),
|
|
30
|
+
"label" character varying(255) NOT NULL,
|
|
31
|
+
"valueType" character varying NOT NULL,
|
|
32
|
+
"stringValue" text,
|
|
33
|
+
"numberValue" double precision,
|
|
34
|
+
"dateValue" TIMESTAMP,
|
|
35
|
+
"boolValue" boolean,
|
|
36
|
+
"contactId" uuid,
|
|
37
|
+
CONSTRAINT "FK_BaseContact_ContactMetadata" FOREIGN KEY ("contactId") REFERENCES "BaseContact" ("id") ON DELETE CASCADE
|
|
38
|
+
)`)
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
public async down(queryRunner: QueryRunner): Promise<void> {
|
|
42
|
+
// Drop the ContactMetadata table
|
|
43
|
+
await queryRunner.query(`DROP TABLE "ContactMetadata"`)
|
|
44
|
+
|
|
45
|
+
// Restore the IdentityMetadata table
|
|
46
|
+
await queryRunner.query(`ALTER TABLE "IdentityMetadata" RENAME TO "temporary_IdentityMetadata"`)
|
|
47
|
+
await queryRunner.query(`CREATE TABLE "IdentityMetadata"
|
|
48
|
+
(
|
|
49
|
+
"id" uuid PRIMARY KEY NOT NULL DEFAULT uuid_generate_v4(),
|
|
50
|
+
"label" character varying(255) NOT NULL,
|
|
51
|
+
"value" character varying(255) NOT NULL,
|
|
52
|
+
"identityId" uuid,
|
|
53
|
+
CONSTRAINT "FK_Identity_IdentityMetadata" FOREIGN KEY ("identityId") REFERENCES "Identity" ("id") ON DELETE CASCADE
|
|
54
|
+
)`)
|
|
55
|
+
await queryRunner.query(`INSERT INTO "IdentityMetadata" ("id", "label", "value", "identityId")
|
|
56
|
+
SELECT "id", "label", "stringValue", "identityId"
|
|
57
|
+
FROM "temporary_IdentityMetadata"`)
|
|
58
|
+
await queryRunner.query(`DROP TABLE "temporary_IdentityMetadata"`)
|
|
59
|
+
}
|
|
60
|
+
}
|
|
@@ -1,25 +1,25 @@
|
|
|
1
|
-
import { MigrationInterface, QueryRunner } from 'typeorm'
|
|
2
|
-
|
|
3
|
-
export class CreatePresentationDefinitions1716475165345 implements MigrationInterface {
|
|
4
|
-
name = 'CreatePresentationDefinitions1716475165345'
|
|
5
|
-
|
|
6
|
-
public async up(queryRunner: QueryRunner): Promise<void> {
|
|
7
|
-
await queryRunner.query(`
|
|
8
|
-
CREATE TABLE "PresentationDefinitionItem" (
|
|
9
|
-
"id" uuid NOT NULL DEFAULT uuid_generate_v4(),
|
|
10
|
-
"tenant_id" TEXT,
|
|
11
|
-
"definition_id" TEXT NOT NULL,
|
|
12
|
-
"name" TEXT,
|
|
13
|
-
"version" TEXT NOT NULL,
|
|
14
|
-
"purpose" TEXT,
|
|
15
|
-
"definition_payload" TEXT NOT NULL,
|
|
16
|
-
"created_at" TIMESTAMP NOT NULL DEFAULT now(),
|
|
17
|
-
"last_updated_at" TIMESTAMP NOT NULL DEFAULT now(),
|
|
18
|
-
CONSTRAINT "PK_PresentationDefinitionItem_id" PRIMARY KEY ("id"))
|
|
19
|
-
`)
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
public async down(queryRunner: QueryRunner): Promise<void> {
|
|
23
|
-
await queryRunner.query(`DROP TABLE "PresentationDefinitionItem"`)
|
|
24
|
-
}
|
|
25
|
-
}
|
|
1
|
+
import { MigrationInterface, QueryRunner } from 'typeorm'
|
|
2
|
+
|
|
3
|
+
export class CreatePresentationDefinitions1716475165345 implements MigrationInterface {
|
|
4
|
+
name = 'CreatePresentationDefinitions1716475165345'
|
|
5
|
+
|
|
6
|
+
public async up(queryRunner: QueryRunner): Promise<void> {
|
|
7
|
+
await queryRunner.query(`
|
|
8
|
+
CREATE TABLE "PresentationDefinitionItem" (
|
|
9
|
+
"id" uuid NOT NULL DEFAULT uuid_generate_v4(),
|
|
10
|
+
"tenant_id" TEXT,
|
|
11
|
+
"definition_id" TEXT NOT NULL,
|
|
12
|
+
"name" TEXT,
|
|
13
|
+
"version" TEXT NOT NULL,
|
|
14
|
+
"purpose" TEXT,
|
|
15
|
+
"definition_payload" TEXT NOT NULL,
|
|
16
|
+
"created_at" TIMESTAMP NOT NULL DEFAULT now(),
|
|
17
|
+
"last_updated_at" TIMESTAMP NOT NULL DEFAULT now(),
|
|
18
|
+
CONSTRAINT "PK_PresentationDefinitionItem_id" PRIMARY KEY ("id"))
|
|
19
|
+
`)
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
public async down(queryRunner: QueryRunner): Promise<void> {
|
|
23
|
+
await queryRunner.query(`DROP TABLE "PresentationDefinitionItem"`)
|
|
24
|
+
}
|
|
25
|
+
}
|
|
@@ -1,110 +1,110 @@
|
|
|
1
|
-
import { MigrationInterface, QueryRunner } from 'typeorm'
|
|
2
|
-
|
|
3
|
-
export class CreateContacts1659463069549 implements MigrationInterface {
|
|
4
|
-
name = 'CreateContacts1659463069549'
|
|
5
|
-
|
|
6
|
-
public async up(queryRunner: QueryRunner): Promise<void> {
|
|
7
|
-
await queryRunner.query(
|
|
8
|
-
`CREATE TABLE "BaseConfigEntity" ("id" varchar PRIMARY KEY NOT NULL, "client_id" varchar(255), "client_secret" varchar(255), "scopes" text, "issuer" varchar(255), "redirect_url" text, "dangerously_allow_insecure_http_requests" boolean, "client_auth_method" text, "identifier" varchar(255), "session_id" varchar(255), "type" varchar NOT NULL, "connectionId" varchar, CONSTRAINT "REL_BaseConfig_connectionId" UNIQUE ("connectionId"))`,
|
|
9
|
-
)
|
|
10
|
-
await queryRunner.query(`CREATE INDEX "IDX_BaseConfigEntity_type" ON "BaseConfigEntity" ("type")`)
|
|
11
|
-
await queryRunner.query(
|
|
12
|
-
`CREATE TABLE "CorrelationIdentifier" ("id" varchar PRIMARY KEY NOT NULL, "type" varchar CHECK( "type" IN ('did','url') ) NOT NULL, "correlation_id" text NOT NULL, "identityId" varchar, CONSTRAINT "UQ_Correlation_id" UNIQUE ("correlation_id"), CONSTRAINT "REL_CorrelationIdentifier_identityId" UNIQUE ("identityId"))`,
|
|
13
|
-
)
|
|
14
|
-
await queryRunner.query(
|
|
15
|
-
`CREATE TABLE "Contact" ("id" varchar PRIMARY KEY NOT NULL, "name" varchar(255) NOT NULL, "alias" varchar(255) NOT NULL, "uri" varchar(255) NOT NULL, "created_at" datetime NOT NULL DEFAULT (datetime('now')), "last_updated_at" datetime NOT NULL DEFAULT (datetime('now')), CONSTRAINT "UQ_Name" UNIQUE ("name"), CONSTRAINT "UQ_Alias" UNIQUE ("alias"))`,
|
|
16
|
-
)
|
|
17
|
-
await queryRunner.query(
|
|
18
|
-
`CREATE TABLE "IdentityMetadata" ("id" varchar PRIMARY KEY NOT NULL, "label" varchar(255) NOT NULL, "value" varchar(255) NOT NULL, "identityId" varchar)`,
|
|
19
|
-
)
|
|
20
|
-
await queryRunner.query(
|
|
21
|
-
`CREATE TABLE "Identity" ("id" varchar PRIMARY KEY NOT NULL, "alias" varchar(255) NOT NULL, "roles" text, "created_at" datetime NOT NULL DEFAULT (datetime('now')), "last_updated_at" datetime NOT NULL DEFAULT (datetime('now')), "contactId" varchar, CONSTRAINT "UQ_Alias" UNIQUE ("alias"))`,
|
|
22
|
-
)
|
|
23
|
-
await queryRunner.query(
|
|
24
|
-
`CREATE TABLE "Connection" ("id" varchar PRIMARY KEY NOT NULL, "type" varchar CHECK( "type" IN ('OIDC','SIOPv2','SIOPv2+OpenID4VP') ) NOT NULL, "identityId" varchar, CONSTRAINT "REL_Connection_identityId" UNIQUE ("identityId"))`,
|
|
25
|
-
)
|
|
26
|
-
await queryRunner.query(`DROP INDEX "IDX_BaseConfigEntity_type"`)
|
|
27
|
-
await queryRunner.query(
|
|
28
|
-
`CREATE TABLE "temporary_BaseConfigEntity" ("id" varchar PRIMARY KEY NOT NULL, "client_id" varchar(255), "client_secret" varchar(255), "scopes" text, "issuer" varchar(255), "redirect_url" text, "dangerously_allow_insecure_http_requests" boolean, "client_auth_method" text, "identifier" varchar(255), "session_id" varchar(255), "type" varchar NOT NULL, "connectionId" varchar, CONSTRAINT "REL_BaseConfig_connectionId" UNIQUE ("connectionId"), CONSTRAINT "FK_BaseConfig_connectionId" FOREIGN KEY ("connectionId") REFERENCES "Connection" ("id") ON DELETE CASCADE ON UPDATE NO ACTION)`,
|
|
29
|
-
)
|
|
30
|
-
await queryRunner.query(
|
|
31
|
-
`INSERT INTO "temporary_BaseConfigEntity"("id", "client_id", "client_secret", "scopes", "issuer", "redirect_url", "dangerously_allow_insecure_http_requests", "client_auth_method", "identifier", "session_id", "type", "connectionId") SELECT "id", "client_id", "client_secret", "scopes", "issuer", "redirect_url", "dangerously_allow_insecure_http_requests", "client_auth_method", "identifier", "session_id", "type", "connectionId" FROM "BaseConfigEntity"`,
|
|
32
|
-
)
|
|
33
|
-
await queryRunner.query(`DROP TABLE "BaseConfigEntity"`)
|
|
34
|
-
await queryRunner.query(`ALTER TABLE "temporary_BaseConfigEntity" RENAME TO "BaseConfigEntity"`)
|
|
35
|
-
await queryRunner.query(`CREATE INDEX "IDX_BaseConfigEntity_type" ON "BaseConfigEntity" ("type")`)
|
|
36
|
-
await queryRunner.query(
|
|
37
|
-
`CREATE TABLE "temporary_CorrelationIdentifier" ("id" varchar PRIMARY KEY NOT NULL, "type" varchar CHECK( "type" IN ('did','url') ) NOT NULL, "correlation_id" text NOT NULL, "identityId" varchar, CONSTRAINT "UQ_Correlation_id" UNIQUE ("correlation_id"), CONSTRAINT "REL_CorrelationIdentifier_identityId" UNIQUE ("identityId"), CONSTRAINT "FK_CorrelationIdentifier_identityId" FOREIGN KEY ("identityId") REFERENCES "Identity" ("id") ON DELETE CASCADE ON UPDATE NO ACTION)`,
|
|
38
|
-
)
|
|
39
|
-
await queryRunner.query(
|
|
40
|
-
`INSERT INTO "temporary_CorrelationIdentifier"("id", "type", "correlation_id", "identityId") SELECT "id", "type", "correlation_id", "identityId" FROM "CorrelationIdentifier"`,
|
|
41
|
-
)
|
|
42
|
-
await queryRunner.query(`DROP TABLE "CorrelationIdentifier"`)
|
|
43
|
-
await queryRunner.query(`ALTER TABLE "temporary_CorrelationIdentifier" RENAME TO "CorrelationIdentifier"`)
|
|
44
|
-
await queryRunner.query(
|
|
45
|
-
`CREATE TABLE "temporary_IdentityMetadata" ("id" varchar PRIMARY KEY NOT NULL, "label" varchar(255) NOT NULL, "value" varchar(255) NOT NULL, "identityId" varchar, CONSTRAINT "FK_IdentityMetadata_identityId" FOREIGN KEY ("identityId") REFERENCES "Identity" ("id") ON DELETE CASCADE ON UPDATE NO ACTION)`,
|
|
46
|
-
)
|
|
47
|
-
await queryRunner.query(
|
|
48
|
-
`INSERT INTO "temporary_IdentityMetadata"("id", "label", "value", "identityId") SELECT "id", "label", "value", "identityId" FROM "IdentityMetadata"`,
|
|
49
|
-
)
|
|
50
|
-
await queryRunner.query(`DROP TABLE "IdentityMetadata"`)
|
|
51
|
-
await queryRunner.query(`ALTER TABLE "temporary_IdentityMetadata" RENAME TO "IdentityMetadata"`)
|
|
52
|
-
await queryRunner.query(
|
|
53
|
-
`CREATE TABLE "temporary_Identity" ("id" varchar PRIMARY KEY NOT NULL, "alias" varchar(255) NOT NULL, "roles" text, "created_at" datetime NOT NULL DEFAULT (datetime('now')), "last_updated_at" datetime NOT NULL DEFAULT (datetime('now')), "contactId" varchar, CONSTRAINT "UQ_Alias" UNIQUE ("alias"), CONSTRAINT "FK_Identity_contactId" FOREIGN KEY ("contactId") REFERENCES "Contact" ("id") ON DELETE CASCADE ON UPDATE NO ACTION)`,
|
|
54
|
-
)
|
|
55
|
-
await queryRunner.query(
|
|
56
|
-
`INSERT INTO "temporary_Identity"("id", "alias", "roles", "created_at", "last_updated_at", "contactId") SELECT "id", "alias", "roles", "created_at", "last_updated_at", "contactId" FROM "Identity"`,
|
|
57
|
-
)
|
|
58
|
-
await queryRunner.query(`DROP TABLE "Identity"`)
|
|
59
|
-
await queryRunner.query(`ALTER TABLE "temporary_Identity" RENAME TO "Identity"`)
|
|
60
|
-
await queryRunner.query(
|
|
61
|
-
`CREATE TABLE "temporary_Connection" ("id" varchar PRIMARY KEY NOT NULL, "type" varchar CHECK( "type" IN ('OIDC','SIOPv2','SIOPv2+OpenID4VP') ) NOT NULL, "identityId" varchar, CONSTRAINT "REL_Connection_identityId" UNIQUE ("identityId"), CONSTRAINT "FK_Connection_identityId" FOREIGN KEY ("identityId") REFERENCES "Identity" ("id") ON DELETE CASCADE ON UPDATE NO ACTION)`,
|
|
62
|
-
)
|
|
63
|
-
await queryRunner.query(`INSERT INTO "temporary_Connection"("id", "type", "identityId") SELECT "id", "type", "identityId" FROM "Connection"`)
|
|
64
|
-
await queryRunner.query(`DROP TABLE "Connection"`)
|
|
65
|
-
await queryRunner.query(`ALTER TABLE "temporary_Connection" RENAME TO "Connection"`)
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
public async down(queryRunner: QueryRunner): Promise<void> {
|
|
69
|
-
await queryRunner.query(`ALTER TABLE "Connection" RENAME TO "temporary_Connection"`)
|
|
70
|
-
await queryRunner.query(
|
|
71
|
-
`CREATE TABLE "Connection" ("id" varchar PRIMARY KEY NOT NULL, "type" varchar CHECK( "type" IN ('OIDC','SIOPv2','SIOPv2+OpenID4VP') ) NOT NULL, "identityId" varchar, CONSTRAINT "REL_Connection_identityId" UNIQUE ("identityId"))`,
|
|
72
|
-
)
|
|
73
|
-
await queryRunner.query(`INSERT INTO "Connection"("id", "type", "identityId") SELECT "id", "type", "identityId" FROM "Connection"`)
|
|
74
|
-
await queryRunner.query(`DROP TABLE "temporary_Connection"`)
|
|
75
|
-
|
|
76
|
-
await queryRunner.query(`ALTER TABLE "Identity" RENAME TO "temporary_Identity"`)
|
|
77
|
-
await queryRunner.query(
|
|
78
|
-
`CREATE TABLE "Identity" ("id" varchar PRIMARY KEY NOT NULL, "alias" varchar(255) NOT NULL, "roles" text, "created_at" datetime NOT NULL DEFAULT (datetime('now')), "last_updated_at" datetime NOT NULL DEFAULT (datetime('now')), "contactId" varchar, CONSTRAINT "UQ_Alias" UNIQUE ("alias"))`,
|
|
79
|
-
)
|
|
80
|
-
await queryRunner.query(
|
|
81
|
-
`INSERT INTO "Identity"("id", "alias", "roles","created_at", "last_updated_at", "contactId") SELECT "id", "alias", "roles","created_at", "last_updated_at", "contactId" FROM "Identity"`,
|
|
82
|
-
)
|
|
83
|
-
await queryRunner.query(`DROP TABLE "temporary_Identity"`)
|
|
84
|
-
|
|
85
|
-
await queryRunner.query(`ALTER TABLE "IdentityMetadata" RENAME TO "temporary_IdentityMetadata"`)
|
|
86
|
-
await queryRunner.query(
|
|
87
|
-
`CREATE TABLE "IdentityMetadata" ("id" varchar PRIMARY KEY NOT NULL, "label" varchar(255) NOT NULL, "value" varchar(255) NOT NULL, "identityId" varchar)`,
|
|
88
|
-
)
|
|
89
|
-
await queryRunner.query(
|
|
90
|
-
`INSERT INTO "IdentityMetadata"("id", "label", "value", "identityId") SELECT "id", "label", "value", "identityId" FROM "IdentityMetadata"`,
|
|
91
|
-
)
|
|
92
|
-
await queryRunner.query(`DROP TABLE "temporary_IdentityMetadata"`)
|
|
93
|
-
|
|
94
|
-
await queryRunner.query(`ALTER TABLE "CorrelationIdentifier" RENAME TO "temporary_CorrelationIdentifier"`)
|
|
95
|
-
await queryRunner.query(
|
|
96
|
-
`CREATE TABLE "CorrelationIdentifier" ("id" varchar PRIMARY KEY NOT NULL, "type" varchar CHECK( "type" IN ('did','url') ) NOT NULL, "correlation_id" text NOT NULL, "identityId" varchar, CONSTRAINT "UQ_Correlation_id" UNIQUE ("correlation_id"), CONSTRAINT "REL_CorrelationIdentifier_identityId" UNIQUE ("identityId"))`,
|
|
97
|
-
)
|
|
98
|
-
await queryRunner.query(
|
|
99
|
-
`INSERT INTO "CorrelationIdentifier"("id", "type", "correlation_id", "identityId") SELECT "id", "type", "correlation_id", "identityId" FROM "CorrelationIdentifier"`,
|
|
100
|
-
)
|
|
101
|
-
await queryRunner.query(`DROP TABLE "temporary_CorrelationIdentifier"`)
|
|
102
|
-
await queryRunner.query(`DROP TABLE "Connection"`)
|
|
103
|
-
await queryRunner.query(`DROP TABLE "Identity"`)
|
|
104
|
-
await queryRunner.query(`DROP TABLE "IdentityMetadata"`)
|
|
105
|
-
await queryRunner.query(`DROP TABLE "Contact"`)
|
|
106
|
-
await queryRunner.query(`DROP TABLE "CorrelationIdentifier"`)
|
|
107
|
-
await queryRunner.query(`DROP INDEX "IDX_BaseConfigEntity_type"`)
|
|
108
|
-
await queryRunner.query(`DROP TABLE "BaseConfigEntity"`)
|
|
109
|
-
}
|
|
110
|
-
}
|
|
1
|
+
import { MigrationInterface, QueryRunner } from 'typeorm'
|
|
2
|
+
|
|
3
|
+
export class CreateContacts1659463069549 implements MigrationInterface {
|
|
4
|
+
name = 'CreateContacts1659463069549'
|
|
5
|
+
|
|
6
|
+
public async up(queryRunner: QueryRunner): Promise<void> {
|
|
7
|
+
await queryRunner.query(
|
|
8
|
+
`CREATE TABLE "BaseConfigEntity" ("id" varchar PRIMARY KEY NOT NULL, "client_id" varchar(255), "client_secret" varchar(255), "scopes" text, "issuer" varchar(255), "redirect_url" text, "dangerously_allow_insecure_http_requests" boolean, "client_auth_method" text, "identifier" varchar(255), "session_id" varchar(255), "type" varchar NOT NULL, "connectionId" varchar, CONSTRAINT "REL_BaseConfig_connectionId" UNIQUE ("connectionId"))`,
|
|
9
|
+
)
|
|
10
|
+
await queryRunner.query(`CREATE INDEX "IDX_BaseConfigEntity_type" ON "BaseConfigEntity" ("type")`)
|
|
11
|
+
await queryRunner.query(
|
|
12
|
+
`CREATE TABLE "CorrelationIdentifier" ("id" varchar PRIMARY KEY NOT NULL, "type" varchar CHECK( "type" IN ('did','url') ) NOT NULL, "correlation_id" text NOT NULL, "identityId" varchar, CONSTRAINT "UQ_Correlation_id" UNIQUE ("correlation_id"), CONSTRAINT "REL_CorrelationIdentifier_identityId" UNIQUE ("identityId"))`,
|
|
13
|
+
)
|
|
14
|
+
await queryRunner.query(
|
|
15
|
+
`CREATE TABLE "Contact" ("id" varchar PRIMARY KEY NOT NULL, "name" varchar(255) NOT NULL, "alias" varchar(255) NOT NULL, "uri" varchar(255) NOT NULL, "created_at" datetime NOT NULL DEFAULT (datetime('now')), "last_updated_at" datetime NOT NULL DEFAULT (datetime('now')), CONSTRAINT "UQ_Name" UNIQUE ("name"), CONSTRAINT "UQ_Alias" UNIQUE ("alias"))`,
|
|
16
|
+
)
|
|
17
|
+
await queryRunner.query(
|
|
18
|
+
`CREATE TABLE "IdentityMetadata" ("id" varchar PRIMARY KEY NOT NULL, "label" varchar(255) NOT NULL, "value" varchar(255) NOT NULL, "identityId" varchar)`,
|
|
19
|
+
)
|
|
20
|
+
await queryRunner.query(
|
|
21
|
+
`CREATE TABLE "Identity" ("id" varchar PRIMARY KEY NOT NULL, "alias" varchar(255) NOT NULL, "roles" text, "created_at" datetime NOT NULL DEFAULT (datetime('now')), "last_updated_at" datetime NOT NULL DEFAULT (datetime('now')), "contactId" varchar, CONSTRAINT "UQ_Alias" UNIQUE ("alias"))`,
|
|
22
|
+
)
|
|
23
|
+
await queryRunner.query(
|
|
24
|
+
`CREATE TABLE "Connection" ("id" varchar PRIMARY KEY NOT NULL, "type" varchar CHECK( "type" IN ('OIDC','SIOPv2','SIOPv2+OpenID4VP') ) NOT NULL, "identityId" varchar, CONSTRAINT "REL_Connection_identityId" UNIQUE ("identityId"))`,
|
|
25
|
+
)
|
|
26
|
+
await queryRunner.query(`DROP INDEX "IDX_BaseConfigEntity_type"`)
|
|
27
|
+
await queryRunner.query(
|
|
28
|
+
`CREATE TABLE "temporary_BaseConfigEntity" ("id" varchar PRIMARY KEY NOT NULL, "client_id" varchar(255), "client_secret" varchar(255), "scopes" text, "issuer" varchar(255), "redirect_url" text, "dangerously_allow_insecure_http_requests" boolean, "client_auth_method" text, "identifier" varchar(255), "session_id" varchar(255), "type" varchar NOT NULL, "connectionId" varchar, CONSTRAINT "REL_BaseConfig_connectionId" UNIQUE ("connectionId"), CONSTRAINT "FK_BaseConfig_connectionId" FOREIGN KEY ("connectionId") REFERENCES "Connection" ("id") ON DELETE CASCADE ON UPDATE NO ACTION)`,
|
|
29
|
+
)
|
|
30
|
+
await queryRunner.query(
|
|
31
|
+
`INSERT INTO "temporary_BaseConfigEntity"("id", "client_id", "client_secret", "scopes", "issuer", "redirect_url", "dangerously_allow_insecure_http_requests", "client_auth_method", "identifier", "session_id", "type", "connectionId") SELECT "id", "client_id", "client_secret", "scopes", "issuer", "redirect_url", "dangerously_allow_insecure_http_requests", "client_auth_method", "identifier", "session_id", "type", "connectionId" FROM "BaseConfigEntity"`,
|
|
32
|
+
)
|
|
33
|
+
await queryRunner.query(`DROP TABLE "BaseConfigEntity"`)
|
|
34
|
+
await queryRunner.query(`ALTER TABLE "temporary_BaseConfigEntity" RENAME TO "BaseConfigEntity"`)
|
|
35
|
+
await queryRunner.query(`CREATE INDEX "IDX_BaseConfigEntity_type" ON "BaseConfigEntity" ("type")`)
|
|
36
|
+
await queryRunner.query(
|
|
37
|
+
`CREATE TABLE "temporary_CorrelationIdentifier" ("id" varchar PRIMARY KEY NOT NULL, "type" varchar CHECK( "type" IN ('did','url') ) NOT NULL, "correlation_id" text NOT NULL, "identityId" varchar, CONSTRAINT "UQ_Correlation_id" UNIQUE ("correlation_id"), CONSTRAINT "REL_CorrelationIdentifier_identityId" UNIQUE ("identityId"), CONSTRAINT "FK_CorrelationIdentifier_identityId" FOREIGN KEY ("identityId") REFERENCES "Identity" ("id") ON DELETE CASCADE ON UPDATE NO ACTION)`,
|
|
38
|
+
)
|
|
39
|
+
await queryRunner.query(
|
|
40
|
+
`INSERT INTO "temporary_CorrelationIdentifier"("id", "type", "correlation_id", "identityId") SELECT "id", "type", "correlation_id", "identityId" FROM "CorrelationIdentifier"`,
|
|
41
|
+
)
|
|
42
|
+
await queryRunner.query(`DROP TABLE "CorrelationIdentifier"`)
|
|
43
|
+
await queryRunner.query(`ALTER TABLE "temporary_CorrelationIdentifier" RENAME TO "CorrelationIdentifier"`)
|
|
44
|
+
await queryRunner.query(
|
|
45
|
+
`CREATE TABLE "temporary_IdentityMetadata" ("id" varchar PRIMARY KEY NOT NULL, "label" varchar(255) NOT NULL, "value" varchar(255) NOT NULL, "identityId" varchar, CONSTRAINT "FK_IdentityMetadata_identityId" FOREIGN KEY ("identityId") REFERENCES "Identity" ("id") ON DELETE CASCADE ON UPDATE NO ACTION)`,
|
|
46
|
+
)
|
|
47
|
+
await queryRunner.query(
|
|
48
|
+
`INSERT INTO "temporary_IdentityMetadata"("id", "label", "value", "identityId") SELECT "id", "label", "value", "identityId" FROM "IdentityMetadata"`,
|
|
49
|
+
)
|
|
50
|
+
await queryRunner.query(`DROP TABLE "IdentityMetadata"`)
|
|
51
|
+
await queryRunner.query(`ALTER TABLE "temporary_IdentityMetadata" RENAME TO "IdentityMetadata"`)
|
|
52
|
+
await queryRunner.query(
|
|
53
|
+
`CREATE TABLE "temporary_Identity" ("id" varchar PRIMARY KEY NOT NULL, "alias" varchar(255) NOT NULL, "roles" text, "created_at" datetime NOT NULL DEFAULT (datetime('now')), "last_updated_at" datetime NOT NULL DEFAULT (datetime('now')), "contactId" varchar, CONSTRAINT "UQ_Alias" UNIQUE ("alias"), CONSTRAINT "FK_Identity_contactId" FOREIGN KEY ("contactId") REFERENCES "Contact" ("id") ON DELETE CASCADE ON UPDATE NO ACTION)`,
|
|
54
|
+
)
|
|
55
|
+
await queryRunner.query(
|
|
56
|
+
`INSERT INTO "temporary_Identity"("id", "alias", "roles", "created_at", "last_updated_at", "contactId") SELECT "id", "alias", "roles", "created_at", "last_updated_at", "contactId" FROM "Identity"`,
|
|
57
|
+
)
|
|
58
|
+
await queryRunner.query(`DROP TABLE "Identity"`)
|
|
59
|
+
await queryRunner.query(`ALTER TABLE "temporary_Identity" RENAME TO "Identity"`)
|
|
60
|
+
await queryRunner.query(
|
|
61
|
+
`CREATE TABLE "temporary_Connection" ("id" varchar PRIMARY KEY NOT NULL, "type" varchar CHECK( "type" IN ('OIDC','SIOPv2','SIOPv2+OpenID4VP') ) NOT NULL, "identityId" varchar, CONSTRAINT "REL_Connection_identityId" UNIQUE ("identityId"), CONSTRAINT "FK_Connection_identityId" FOREIGN KEY ("identityId") REFERENCES "Identity" ("id") ON DELETE CASCADE ON UPDATE NO ACTION)`,
|
|
62
|
+
)
|
|
63
|
+
await queryRunner.query(`INSERT INTO "temporary_Connection"("id", "type", "identityId") SELECT "id", "type", "identityId" FROM "Connection"`)
|
|
64
|
+
await queryRunner.query(`DROP TABLE "Connection"`)
|
|
65
|
+
await queryRunner.query(`ALTER TABLE "temporary_Connection" RENAME TO "Connection"`)
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
public async down(queryRunner: QueryRunner): Promise<void> {
|
|
69
|
+
await queryRunner.query(`ALTER TABLE "Connection" RENAME TO "temporary_Connection"`)
|
|
70
|
+
await queryRunner.query(
|
|
71
|
+
`CREATE TABLE "Connection" ("id" varchar PRIMARY KEY NOT NULL, "type" varchar CHECK( "type" IN ('OIDC','SIOPv2','SIOPv2+OpenID4VP') ) NOT NULL, "identityId" varchar, CONSTRAINT "REL_Connection_identityId" UNIQUE ("identityId"))`,
|
|
72
|
+
)
|
|
73
|
+
await queryRunner.query(`INSERT INTO "Connection"("id", "type", "identityId") SELECT "id", "type", "identityId" FROM "Connection"`)
|
|
74
|
+
await queryRunner.query(`DROP TABLE "temporary_Connection"`)
|
|
75
|
+
|
|
76
|
+
await queryRunner.query(`ALTER TABLE "Identity" RENAME TO "temporary_Identity"`)
|
|
77
|
+
await queryRunner.query(
|
|
78
|
+
`CREATE TABLE "Identity" ("id" varchar PRIMARY KEY NOT NULL, "alias" varchar(255) NOT NULL, "roles" text, "created_at" datetime NOT NULL DEFAULT (datetime('now')), "last_updated_at" datetime NOT NULL DEFAULT (datetime('now')), "contactId" varchar, CONSTRAINT "UQ_Alias" UNIQUE ("alias"))`,
|
|
79
|
+
)
|
|
80
|
+
await queryRunner.query(
|
|
81
|
+
`INSERT INTO "Identity"("id", "alias", "roles","created_at", "last_updated_at", "contactId") SELECT "id", "alias", "roles","created_at", "last_updated_at", "contactId" FROM "Identity"`,
|
|
82
|
+
)
|
|
83
|
+
await queryRunner.query(`DROP TABLE "temporary_Identity"`)
|
|
84
|
+
|
|
85
|
+
await queryRunner.query(`ALTER TABLE "IdentityMetadata" RENAME TO "temporary_IdentityMetadata"`)
|
|
86
|
+
await queryRunner.query(
|
|
87
|
+
`CREATE TABLE "IdentityMetadata" ("id" varchar PRIMARY KEY NOT NULL, "label" varchar(255) NOT NULL, "value" varchar(255) NOT NULL, "identityId" varchar)`,
|
|
88
|
+
)
|
|
89
|
+
await queryRunner.query(
|
|
90
|
+
`INSERT INTO "IdentityMetadata"("id", "label", "value", "identityId") SELECT "id", "label", "value", "identityId" FROM "IdentityMetadata"`,
|
|
91
|
+
)
|
|
92
|
+
await queryRunner.query(`DROP TABLE "temporary_IdentityMetadata"`)
|
|
93
|
+
|
|
94
|
+
await queryRunner.query(`ALTER TABLE "CorrelationIdentifier" RENAME TO "temporary_CorrelationIdentifier"`)
|
|
95
|
+
await queryRunner.query(
|
|
96
|
+
`CREATE TABLE "CorrelationIdentifier" ("id" varchar PRIMARY KEY NOT NULL, "type" varchar CHECK( "type" IN ('did','url') ) NOT NULL, "correlation_id" text NOT NULL, "identityId" varchar, CONSTRAINT "UQ_Correlation_id" UNIQUE ("correlation_id"), CONSTRAINT "REL_CorrelationIdentifier_identityId" UNIQUE ("identityId"))`,
|
|
97
|
+
)
|
|
98
|
+
await queryRunner.query(
|
|
99
|
+
`INSERT INTO "CorrelationIdentifier"("id", "type", "correlation_id", "identityId") SELECT "id", "type", "correlation_id", "identityId" FROM "CorrelationIdentifier"`,
|
|
100
|
+
)
|
|
101
|
+
await queryRunner.query(`DROP TABLE "temporary_CorrelationIdentifier"`)
|
|
102
|
+
await queryRunner.query(`DROP TABLE "Connection"`)
|
|
103
|
+
await queryRunner.query(`DROP TABLE "Identity"`)
|
|
104
|
+
await queryRunner.query(`DROP TABLE "IdentityMetadata"`)
|
|
105
|
+
await queryRunner.query(`DROP TABLE "Contact"`)
|
|
106
|
+
await queryRunner.query(`DROP TABLE "CorrelationIdentifier"`)
|
|
107
|
+
await queryRunner.query(`DROP INDEX "IDX_BaseConfigEntity_type"`)
|
|
108
|
+
await queryRunner.query(`DROP TABLE "BaseConfigEntity"`)
|
|
109
|
+
}
|
|
110
|
+
}
|