| 1 | /* |
| 2 | * Copyright (c) 2024 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 participant_context |
| 17 | ( |
| 18 | participant_id VARCHAR PRIMARY KEY NOT NULL, -- ID of the ParticipantContext |
| 19 | created_date BIGINT NOT NULL, -- POSIX timestamp of the creation of the PC |
| 20 | last_modified_date BIGINT, -- POSIX timestamp of the last modified date |
| 21 | state INTEGER NOT NULL, -- 0 = CREATED, 1 = ACTIVE, 2 = DEACTIVATED |
| 22 | api_token_alias VARCHAR NOT NULL, -- alias under which this PC's api token is stored in the vault |
| 23 | did VARCHAR, -- the DID with which this participant is identified |
| 24 | roles JSON -- JSON array containing all the roles a user has. may be empty |
| 25 | ); |
| 26 | CREATE UNIQUE INDEX IF NOT EXISTS participant_context_participant_id_uindex ON participant_context USING btree (participant_id); |
| 27 | |