@sphereon/ssi-sdk.data-store 0.34.1-feature.SSISDK.17.bitstring.sl.2 → 0.34.1-next.3

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.
@@ -1,103 +0,0 @@
1
- import { MigrationInterface, QueryRunner } from 'typeorm'
2
-
3
- export class CreateBitstringStatusListSqlite1741895823001 implements MigrationInterface {
4
- name = 'CreateBitstringStatusList1741895823000'
5
-
6
- public async up(queryRunner: QueryRunner): Promise<void> {
7
- // Update StatusList table to include BitstringStatusList type and columns
8
- await queryRunner.query(`
9
- CREATE TABLE "temporary_StatusList" (
10
- "id" varchar PRIMARY KEY NOT NULL,
11
- "correlationId" varchar NOT NULL,
12
- "length" integer NOT NULL,
13
- "issuer" text NOT NULL,
14
- "type" varchar CHECK( "type" IN ('StatusList2021', 'OAuthStatusList', 'BitstringStatusList') ) NOT NULL DEFAULT ('StatusList2021'),
15
- "driverType" varchar CHECK( "driverType" IN ('agent_typeorm','agent_kv_store','github','agent_filesystem') ) NOT NULL DEFAULT ('agent_typeorm'),
16
- "credentialIdMode" varchar CHECK( "credentialIdMode" IN ('ISSUANCE','PERSISTENCE','NEVER') ) NOT NULL DEFAULT ('ISSUANCE'),
17
- "proofFormat" varchar CHECK( "proofFormat" IN ('lds','jwt') ) NOT NULL DEFAULT ('lds'),
18
- "indexingDirection" varchar CHECK( "indexingDirection" IN ('rightToLeft') ),
19
- "statusPurpose" varchar,
20
- "statusListCredential" text,
21
- "bitsPerStatus" integer,
22
- "expiresAt" datetime,
23
- "statusSize" integer DEFAULT (1),
24
- "ttl" integer,
25
- "validFrom" datetime,
26
- "validUntil" datetime,
27
- CONSTRAINT "UQ_correlationId" UNIQUE ("correlationId")
28
- )
29
- `)
30
-
31
- await queryRunner.query(`
32
- INSERT INTO "temporary_StatusList"(
33
- "id", "correlationId", "length", "issuer", "type", "driverType",
34
- "credentialIdMode", "proofFormat", "indexingDirection", "statusPurpose",
35
- "statusListCredential", "bitsPerStatus", "expiresAt"
36
- )
37
- SELECT
38
- "id", "correlationId", "length", "issuer", "type", "driverType",
39
- "credentialIdMode", "proofFormat", "indexingDirection", "statusPurpose",
40
- "statusListCredential", "bitsPerStatus", "expiresAt"
41
- FROM "StatusList"
42
- `)
43
-
44
- await queryRunner.query(`DROP TABLE "StatusList"`)
45
- await queryRunner.query(`ALTER TABLE "temporary_StatusList" RENAME TO "StatusList"`)
46
-
47
- // Create BitstringStatusListEntry table
48
- await queryRunner.query(`
49
- CREATE TABLE "BitstringStatusListEntry" (
50
- "statusListId" varchar NOT NULL,
51
- "statusListIndex" integer NOT NULL,
52
- "credentialId" text,
53
- "credentialHash" varchar(128),
54
- "correlationId" varchar(255),
55
- "statusPurpose" varchar NOT NULL,
56
- "statusSize" integer DEFAULT (1),
57
- "statusMessage" text,
58
- "statusReference" text,
59
- PRIMARY KEY ("statusListId", "statusListIndex")
60
- )
61
- `)
62
- }
63
-
64
- public async down(queryRunner: QueryRunner): Promise<void> {
65
- await queryRunner.query(`DROP TABLE "BitstringStatusListEntry"`)
66
-
67
- await queryRunner.query(`
68
- CREATE TABLE "temporary_StatusList" (
69
- "id" varchar PRIMARY KEY NOT NULL,
70
- "correlationId" varchar NOT NULL,
71
- "length" integer NOT NULL,
72
- "issuer" text NOT NULL,
73
- "type" varchar CHECK( "type" IN ('StatusList2021', 'OAuthStatusList') ) NOT NULL DEFAULT ('StatusList2021'),
74
- "driverType" varchar CHECK( "driverType" IN ('agent_typeorm','agent_kv_store','github','agent_filesystem') ) NOT NULL DEFAULT ('agent_typeorm'),
75
- "credentialIdMode" varchar CHECK( "credentialIdMode" IN ('ISSUANCE','PERSISTENCE','NEVER') ) NOT NULL DEFAULT ('ISSUANCE'),
76
- "proofFormat" varchar CHECK( "proofFormat" IN ('lds','jwt') ) NOT NULL DEFAULT ('lds'),
77
- "indexingDirection" varchar CHECK( "indexingDirection" IN ('rightToLeft') ),
78
- "statusPurpose" varchar,
79
- "statusListCredential" text,
80
- "bitsPerStatus" integer,
81
- "expiresAt" datetime,
82
- CONSTRAINT "UQ_correlationId" UNIQUE ("correlationId")
83
- )
84
- `)
85
-
86
- await queryRunner.query(`
87
- INSERT INTO "temporary_StatusList"(
88
- "id", "correlationId", "length", "issuer", "type", "driverType",
89
- "credentialIdMode", "proofFormat", "indexingDirection", "statusPurpose",
90
- "statusListCredential", "bitsPerStatus", "expiresAt"
91
- )
92
- SELECT
93
- "id", "correlationId", "length", "issuer",
94
- CASE WHEN "type" = 'BitstringStatusList' THEN 'StatusList2021' ELSE "type" END,
95
- "driverType", "credentialIdMode", "proofFormat", "indexingDirection",
96
- "statusPurpose", "statusListCredential", "bitsPerStatus", "expiresAt"
97
- FROM "StatusList"
98
- `)
99
-
100
- await queryRunner.query(`DROP TABLE "StatusList"`)
101
- await queryRunner.query(`ALTER TABLE "temporary_StatusList" RENAME TO "StatusList"`)
102
- }
103
- }