| 1 | /* |
| 2 | * Copyright (c) 2023 Metaform Systems, Inc. |
| 3 | * |
| 4 | * This program and the accompanying materials are made available under the |
| 5 | * terms of the Apache License, Version 2.0 which is available at |
| 6 | * https://www.apache.org/licenses/LICENSE-2.0 |
| 7 | * |
| 8 | * SPDX-License-Identifier: Apache-2.0 |
| 9 | * |
| 10 | * Contributors: |
| 11 | * Metaform Systems, Inc. - initial API and implementation |
| 12 | * |
| 13 | */ |
| 14 | |
| 15 | -- only intended for and tested with Postgres! |
| 16 | CREATE TABLE IF NOT EXISTS credential_resource |
| 17 | ( |
| 18 | id VARCHAR PRIMARY KEY NOT NULL, -- ID of the VC, duplicated here for indexing purposes |
| 19 | create_timestamp BIGINT NOT NULL, -- POSIX timestamp of the creation of the VC |
| 20 | issuer_id VARCHAR NOT NULL, |
| 21 | holder_id VARCHAR NOT NULL, |
| 22 | vc_state INTEGER NOT NULL, |
| 23 | issuance_policy JSON, |
| 24 | reissuance_policy JSON, |
| 25 | raw_vc VARCHAR NOT NULL, -- Representation of the VC exactly as it was received by the issuer. Can be JWT or JSON(-LD) |
| 26 | vc_format INTEGER NOT NULL, -- 0 = JSON-LD, 1 = JWT |
| 27 | verifiable_credential JSON NOT NULL, -- JSON-representation of the verifiable credential |
| 28 | participant_id VARCHAR -- ID of the ParticipantContext that owns this credentisl |
| 29 | ); |
| 30 | CREATE UNIQUE INDEX IF NOT EXISTS credential_resource_credential_id_uindex ON credential_resource USING btree (id); |
| 31 | COMMENT ON COLUMN credential_resource.id IS 'ID of the VC, duplicated here for indexing purposes'; |
| 32 | COMMENT ON COLUMN credential_resource.raw_vc IS 'Representation of the VC exactly as it was received by the issuer. Can be JWT or JSON(-LD) '; |
| 33 | COMMENT ON COLUMN credential_resource.vc_format IS '0 = JSON-LD, 1 = JWT'; |
| 34 | COMMENT ON COLUMN credential_resource.verifiable_credential IS 'JSON-representation of the VerifiableCredential'; |
| 35 | |