Skip to content

Commit

Permalink
Merge pull request #1038 from kian99/migration-fix
Browse files Browse the repository at this point in the history
Fixes for migration and OpenFGA port
  • Loading branch information
kian99 committed Aug 29, 2023
2 parents c2d2df7 + 407a3f2 commit 48fff0e
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 9 deletions.
3 changes: 2 additions & 1 deletion docker-compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,8 @@ services:
PUBLIC_KEY: "izcYsQy3TePp6bLjqOo3IRPFvkQd2IKtyODGqC6SdFk="
PRIVATE_KEY: "ly/dzsI9Nt/4JxUILQeAX79qZ4mygDiuYGqc2ZEiDEc="
OPENFGA_SCHEME: "http"
OPENFGA_HOST: "openfga:8080"
OPENFGA_HOST: "openfga"
OPENFGA_PORT: 8080
OPENFGA_STORE: "01GP1254CHWJC1MNGVB0WDG1T0"
OPENFGA_AUTH_MODEL: "01GP1EC038KHGB6JJ2XXXXCXKB"
OPENFGA_TOKEN: "jimm"
Expand Down
13 changes: 6 additions & 7 deletions internal/dbmodel/sql/postgres/1_3.sql
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
-- 1_3.sql is a migration that alters the foreign key relationship `cloud_credentials.cloud_name -> clouds.name` to a cascade on-delete.

alter table cloud_credentials
drop constraint cloud_credentials_cloud_name_fkey,
add constraint cloud_credentials_cloud_name_fkey
foreign key (cloud_name)
references clouds(name)
on delete cascade;
ALTER TABLE
ALTER TABLE cloud_credentials
DROP CONSTRAINT cloud_credentials_cloud_name_fkey,
ADD CONSTRAINT cloud_credentials_cloud_name_fkey
FOREIGN KEY (cloud_name)
REFERENCES clouds(name)
ON DELETE CASCADE;

UPDATE versions SET major=1, minor=3 WHERE component='jimmdb';
3 changes: 2 additions & 1 deletion service.go
Original file line number Diff line number Diff line change
Expand Up @@ -534,6 +534,7 @@ func newVaultStore(ctx context.Context, p Params) (jimmcreds.CredentialStore, er
}

func newOpenFGAClient(ctx context.Context, p OpenFGAParams) (*openfga.OFGAClient, error) {
const op = errors.Op("newOpenFGAClient")
cofgaClient, err := cofga.NewClient(ctx, cofga.OpenFGAParams{
Scheme: p.Scheme,
Host: p.Host,
Expand All @@ -543,7 +544,7 @@ func newOpenFGAClient(ctx context.Context, p OpenFGAParams) (*openfga.OFGAClient
AuthModelID: p.AuthModel,
})
if err != nil {
return nil, errors.E(err, "failed to create ofga client")
return nil, errors.E(op, err)
}
return openfga.NewOpenFGAClient(cofgaClient), nil
}
Expand Down

0 comments on commit 48fff0e

Please sign in to comment.