Skip to content

Commit

Permalink
fix: add missing IF NOT EXIST statements in SQL stores
Browse files Browse the repository at this point in the history
  • Loading branch information
bscholtes1A committed Mar 22, 2024
1 parent 989e445 commit 18272cb
Show file tree
Hide file tree
Showing 7 changed files with 9 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

package org.eclipse.edc.identityhub.api;

import org.eclipse.edc.core.transform.transformer.edc.to.JsonValueToGenericTypeTransformer;
import org.eclipse.edc.core.transform.transformer.to.JsonValueToGenericTypeTransformer;
import org.eclipse.edc.iam.identitytrust.transform.to.JsonObjectToPresentationQueryTransformer;
import org.eclipse.edc.identityhub.api.v1.PresentationApiController;
import org.eclipse.edc.identityhub.api.validation.PresentationQueryValidator;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
import org.eclipse.edc.connector.core.store.ReflectionPropertyLookup;
import org.eclipse.edc.identityhub.spi.model.VerifiableCredentialResource;
import org.eclipse.edc.identitytrust.model.VerifiableCredentialContainer;
import org.eclipse.edc.util.reflection.PathItem;
import org.eclipse.edc.spi.types.PathItem;
import org.eclipse.edc.util.reflection.ReflectionUtil;

import java.time.Instant;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@
import java.util.Map;

import static io.restassured.RestAssured.given;
import static org.eclipse.edc.boot.BootServicesExtension.PARTICIPANT_ID;
import static org.eclipse.edc.junit.testfixtures.TestUtils.getFreePort;
import static org.eclipse.edc.spi.system.ServiceExtensionContext.PARTICIPANT_ID;

/**
* The IdentityHubRuntimeConfiguration class represents an IdentityHub Runtime configuration and provides various information, such as API endpoints
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
*/

-- only intended for and tested with Postgres!
CREATE TABLE credential_resource
CREATE TABLE IF NOT EXISTS credential_resource
(
id VARCHAR PRIMARY KEY NOT NULL, -- ID of the VC, duplicated here for indexing purposes
create_timestamp BIGINT NOT NULL, -- POSIX timestamp of the creation of the VC
Expand All @@ -27,7 +27,7 @@ CREATE TABLE credential_resource
verifiable_credential JSON NOT NULL, -- JSON-representation of the verifiable credential
participant_id VARCHAR -- ID of the ParticipantContext that owns this credentisl
);
CREATE UNIQUE INDEX credential_resource_credential_id_uindex ON credential_resource USING btree (id);
CREATE UNIQUE INDEX IF NOT EXISTS credential_resource_credential_id_uindex ON credential_resource USING btree (id);
COMMENT ON COLUMN credential_resource.id IS 'ID of the VC, duplicated here for indexing purposes';
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) ';
COMMENT ON COLUMN credential_resource.vc_format IS '0 = JSON-LD, 1 = JWT';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@

package org.eclipse.edc.identityhub.store.sql.credentials.schema.postgres;

import org.eclipse.edc.spi.types.PathItem;
import org.eclipse.edc.sql.translation.JsonFieldTranslator;
import org.eclipse.edc.util.reflection.PathItem;

import java.util.ArrayList;
import java.util.HashMap;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
*/

-- only intended for and tested with Postgres!
CREATE TABLE keypair_resource
CREATE TABLE IF NOT EXISTS keypair_resource
(
id VARCHAR PRIMARY KEY NOT NULL, -- primary key
participant_id VARCHAR, -- ID of the owning ParticipantContext. this is a loose business key, not a FK!
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
*/

-- only intended for and tested with Postgres!
CREATE TABLE participant_context
CREATE TABLE IF NOT EXISTS participant_context
(
participant_id VARCHAR PRIMARY KEY NOT NULL, -- ID of the ParticipantContext
created_date BIGINT NOT NULL, -- POSIX timestamp of the creation of the PC
Expand All @@ -23,5 +23,5 @@ CREATE TABLE participant_context
did VARCHAR, -- the DID with which this participant is identified
roles JSON -- JSON array containing all the roles a user has. may be empty
);
CREATE UNIQUE INDEX participant_context_participant_id_uindex ON participant_context USING btree (participant_id);
CREATE UNIQUE INDEX IF NOT EXISTS participant_context_participant_id_uindex ON participant_context USING btree (participant_id);

0 comments on commit 18272cb

Please sign in to comment.