Skip to content

Commit

Permalink
change gomigrate for dbmate
Browse files Browse the repository at this point in the history
  • Loading branch information
woutslakhorst committed Dec 5, 2023
1 parent c7e85d1 commit 1c51797
Show file tree
Hide file tree
Showing 12 changed files with 174 additions and 71 deletions.
47 changes: 47 additions & 0 deletions db/schema.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
CREATE TABLE IF NOT EXISTS "schema_migrations" (version varchar(128) primary key);
CREATE TABLE discovery_service
(
-- id is the unique identifier for the service. It comes from the service definition.
id varchar(200) not null primary key,
lamport_timestamp integer not null
);
CREATE TABLE discovery_presentation
(
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 discovery_service (id) on delete cascade
);
CREATE INDEX idx_discovery_presentation_expiration on discovery_presentation (presentation_expiration);
CREATE TABLE discovery_credential
(
id varchar(36) not null primary key,
-- presentation_id is NOT the ID of the presentation (VerifiablePresentation.ID), but refers to the presentation record in the discovery_presentation table.
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 varchar,
constraint fk_discovery_credential_presentation foreign key (presentation_id) references discovery_presentation (id) on delete cascade
);
CREATE TABLE discovery_credential_prop
(
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_discovery_credential_id foreign key (credential_id) references discovery_credential (id) on delete cascade
);
-- Dbmate schema migrations
INSERT INTO "schema_migrations" (version) VALUES
('001'),
('002');
22 changes: 13 additions & 9 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@ go 1.21
require (
github.com/PaesslerAG/jsonpath v0.1.2-0.20230323094847-3484786d6f97
github.com/alicebob/miniredis/v2 v2.31.0
github.com/amacneil/dbmate/v2 v2.8.0
github.com/avast/retry-go/v4 v4.5.1
github.com/cbroglie/mustache v1.4.0
github.com/chromedp/chromedp v0.9.3
github.com/dlclark/regexp2 v1.10.0
github.com/golang-jwt/jwt v3.2.2+incompatible
github.com/golang-migrate/migrate/v4 v4.16.2
github.com/goodsign/monday v1.0.1
github.com/google/uuid v1.4.0
github.com/hashicorp/vault/api v1.10.0
Expand Down Expand Up @@ -52,7 +52,6 @@ require (
gopkg.in/Regis24GmbH/go-phonetics.v2 v2.0.3
gopkg.in/yaml.v3 v3.0.1
schneider.vip/problem v1.9.0

)

require (
Expand All @@ -75,6 +74,7 @@ require (
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/decred/dcrd/dcrec/secp256k1/v4 v4.2.0 // indirect
github.com/dgryski/go-rendezvous v0.0.0-20200823014737-9f7001d12a5f // indirect
github.com/dustin/go-humanize v1.0.1 // indirect
github.com/edsrzf/mmap-go v1.1.0 // indirect
github.com/eknkc/basex v1.0.1 // indirect
github.com/fatih/color v1.13.0 // indirect
Expand All @@ -87,13 +87,16 @@ require (
github.com/go-jose/go-jose/v3 v3.0.1 // indirect
github.com/go-redis/redis/v8 v8.11.5 // indirect
github.com/go-redsync/redsync/v4 v4.8.1 // indirect
github.com/go-sql-driver/mysql v1.6.0 // indirect
github.com/go-sql-driver/mysql v1.7.1 // indirect
github.com/gobwas/httphead v0.1.0 // indirect
github.com/gobwas/pool v0.2.1 // indirect
github.com/gobwas/ws v1.3.0 // indirect
github.com/goccy/go-json v0.10.2 // indirect
github.com/golang-jwt/jwt/v4 v4.4.2 // indirect
github.com/golang-jwt/jwt/v4 v4.5.0 // indirect
github.com/golang-sql/civil v0.0.0-20220223132316-b832511892a9 // indirect
github.com/golang/protobuf v1.5.3 // indirect
github.com/google/flatbuffers v2.0.8+incompatible // indirect
github.com/google/go-cmp v0.6.0 // indirect
github.com/hashicorp/errwrap v1.1.0 // indirect
github.com/hashicorp/go-cleanhttp v0.5.2 // indirect
github.com/hashicorp/go-multierror v1.1.1 // indirect
Expand All @@ -115,7 +118,7 @@ require (
github.com/lestrrat-go/httprc v1.0.4 // indirect
github.com/lestrrat-go/iter v1.0.2 // indirect
github.com/lestrrat-go/option v1.0.1 // indirect
github.com/lib/pq v1.10.6 // indirect
github.com/lib/pq v1.10.9 // indirect
github.com/mailru/easyjson v0.7.7 // indirect
github.com/mattn/go-colorable v0.1.13 // indirect
github.com/mattn/go-isatty v0.0.20 // indirect
Expand All @@ -141,7 +144,7 @@ require (
github.com/pquerna/cachecontrol v0.0.0-20180517163645-1555304b9b35 // indirect
github.com/privacybydesign/gabi v0.0.0-20221012093643-8e978bfbb252 // indirect
github.com/prometheus/common v0.44.0 // indirect
github.com/prometheus/procfs v0.11.1 // indirect
github.com/prometheus/procfs v0.12.0 // indirect
github.com/robfig/cron/v3 v3.0.1 // indirect
github.com/rogpeppe/go-internal v1.11.0 // indirect
github.com/ryanuber/go-glob v1.0.0 // indirect
Expand All @@ -161,12 +164,13 @@ require (
github.com/x-cray/logrus-prefixed-formatter v0.5.2 // indirect
github.com/x448/float16 v0.8.4 // indirect
github.com/yuin/gopher-lua v1.1.0 // indirect
golang.org/x/net v0.17.0 // indirect
golang.org/x/sync v0.3.0 // indirect
go.opencensus.io v0.24.0 // indirect
golang.org/x/net v0.18.0 // indirect
golang.org/x/sync v0.5.0 // indirect
golang.org/x/sys v0.15.0 // indirect
golang.org/x/term v0.15.0 // indirect
golang.org/x/text v0.14.0 // indirect
google.golang.org/genproto/googleapis/rpc v0.0.0-20230822172742-b8732ec3820d // indirect
google.golang.org/genproto/googleapis/rpc v0.0.0-20231106174013-bbf56f31fb17 // indirect
gopkg.in/Regis24GmbH/go-diacritics.v2 v2.0.3 // indirect
gorm.io/driver/sqlite v1.5.4
gorm.io/gorm v1.25.5
Expand Down
Loading

0 comments on commit 1c51797

Please sign in to comment.