-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
10 changed files
with
74 additions
and
98 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,49 +1,49 @@ | ||
-- discoveryservices contains the known discovery services and the highest timestamp | ||
create table discoveryservices | ||
-- discovery contains the known discovery services and the highest timestamp | ||
create table discovery_service | ||
( | ||
id text not null primary key, | ||
timestamp integer not null | ||
id varchar(36) not null primary key, | ||
lamport_timestamp integer not null | ||
); | ||
|
||
-- discoveryservice_presentations contains the presentations of the discovery services | ||
create table discoveryservice_presentations | ||
-- discovery_presentation contains the presentations of the discovery services | ||
create table discovery_presentation | ||
( | ||
id text not null primary key, | ||
service_id text not null, | ||
timestamp integer not null, | ||
credential_subject_id text not null, | ||
presentation_id text not null, | ||
presentation_raw text not null, | ||
presentation_expiration integer not null, | ||
id varchar(36) not null primary key, | ||
service_id varchar(36) not null, | ||
lamport_timestamp integer not null, | ||
credential_subject_id varchar not null, | ||
presentation_id varchar not null, | ||
presentation_raw varchar not null, | ||
presentation_expiration integer not null, | ||
unique (service_id, credential_subject_id), | ||
constraint fk_discovery_presentation_service_id foreign key (service_id) references discoveryservices (id) on delete cascade | ||
constraint fk_discovery_presentation_service_id foreign key (service_id) references discovery_service (id) on delete cascade | ||
); | ||
|
||
-- discoveryservice_credentials is a credential in a presentation of the discovery service. | ||
-- discovery_credential is a credential in a presentation of the discovery service. | ||
-- We could do without the table, but having it allows to have a normalized index for credential properties that appear on every credential. | ||
-- Then we don't need rows in the properties table for them (having a column for those is faster than having a row in the properties table which needs to be joined). | ||
create table discoveryservice_credentials | ||
create table discovery_credential | ||
( | ||
id text not null primary key, | ||
presentation_id text not null, | ||
credential_id text not null, | ||
credential_issuer text not null, | ||
credential_subject_id text not null, | ||
id varchar(36) not null primary key, | ||
presentation_id varchar(36) not null, | ||
credential_id varchar not null, | ||
credential_issuer varchar not null, | ||
credential_subject_id varchar not null, | ||
-- for now, credentials with at most 2 types are supported. | ||
-- The type stored in the type column will be the 'other' type, not being 'VerifiableCredential'. | ||
-- When credentials with 3 or more types appear, we could have to use a separate table for the types. | ||
credential_type text, | ||
constraint fk_discoveryservice_credential_presentation foreign key (presentation_id) references discoveryservice_presentations (id) on delete cascade | ||
credential_type varchar, | ||
constraint fk_discoveryservice_credential_presentation foreign key (presentation_id) references discovery_presentation (id) on delete cascade | ||
); | ||
|
||
-- discoveryservice_credential_props contains the credentialSubject properties of a credential in a presentation of the discovery service. | ||
-- discovery_credential_prop contains the credentialSubject properties of a credential in a presentation of the discovery service. | ||
-- It is used by clients to search for presentations. | ||
create table discoveryservice_credential_props | ||
create table discovery_credential_prop | ||
( | ||
id text not null, | ||
key text not null, | ||
value text, | ||
PRIMARY KEY (id, key), | ||
credential_id varchar(36) not null, | ||
key varchar not null, | ||
value varchar, | ||
PRIMARY KEY (credential_id, key), | ||
-- cascading delete: if the presentation gets deleted, the properties get deleted as well | ||
constraint fk_discoveryservice_credential_id foreign key (id) references discoveryservice_credentials (id) on delete cascade | ||
constraint fk_discoveryservice_credential_id foreign key (credential_id) references discovery_credential (id) on delete cascade | ||
); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters