diff --git a/backend/pkg/database/gorm_repository_migrations.go b/backend/pkg/database/gorm_repository_migrations.go index 630a3db5..ec3f7c2c 100644 --- a/backend/pkg/database/gorm_repository_migrations.go +++ b/backend/pkg/database/gorm_repository_migrations.go @@ -7,13 +7,13 @@ import ( _20231201122541 "github.com/fastenhealth/fasten-onprem/backend/pkg/database/migrations/20231201122541" _0240114092806 "github.com/fastenhealth/fasten-onprem/backend/pkg/database/migrations/20240114092806" _20240114103850 "github.com/fastenhealth/fasten-onprem/backend/pkg/database/migrations/20240114103850" - "github.com/fastenhealth/fasten-onprem/backend/pkg/models" databaseModel "github.com/fastenhealth/fasten-onprem/backend/pkg/models/database" sourceCatalog "github.com/fastenhealth/fasten-sources/catalog" sourcePkg "github.com/fastenhealth/fasten-sources/pkg" "github.com/go-gormigrate/gormigrate/v2" "github.com/google/uuid" "gorm.io/gorm" + "log" ) func (gr *GormRepository) Migrate() error { @@ -108,8 +108,9 @@ func (gr *GormRepository) Migrate() error { tx.Logger.Info(context.Background(), fmt.Sprintf("Mapping Legacy SourceType (%s) to Brand, Portal and Endpoint IDs: %s", sourceCredential.SourceType, sourceCredential.ID)) - matchingBrand, matchingPortal, matchingEndpoint, err := sourceCatalog.GetPatientAccessInfoForLegacySourceType(sourceCredential.SourceType, sourceCredential.ApiEndpointBaseUrl) + matchingBrand, matchingPortal, matchingEndpoint, endpointEnv, err := sourceCatalog.GetPatientAccessInfoForLegacySourceType(sourceCredential.SourceType, sourceCredential.ApiEndpointBaseUrl) if err != nil { + log.Printf("An error occurred getting Patient Access Info for Legacy SourceType: %s", sourceCredential.SourceType) tx.Logger.Error(context.Background(), err.Error()) return err } @@ -120,6 +121,7 @@ func (gr *GormRepository) Migrate() error { sourceCredential.BrandID = &brandId sourceCredential.EndpointID = uuid.MustParse(matchingEndpoint.Id) sourceCredential.PlatformType = string(matchingEndpoint.GetPlatformType()) + sourceCredential.LighthouseEnvType = endpointEnv fastenUpdateSourceCredential := tx.Save(sourceCredential) if fastenUpdateSourceCredential.Error != nil { @@ -142,19 +144,19 @@ func (gr *GormRepository) Migrate() error { }) // run when database is empty - m.InitSchema(func(tx *gorm.DB) error { - err := tx.AutoMigrate( - &models.BackgroundJob{}, - &models.Glossary{}, - &models.SourceCredential{}, - &models.UserSettingEntry{}, - &models.User{}, - ) - if err != nil { - return err - } - return nil - }) + //m.InitSchema(func(tx *gorm.DB) error { + // err := tx.AutoMigrate( + // &models.BackgroundJob{}, + // &models.Glossary{}, + // &models.SourceCredential{}, + // &models.UserSettingEntry{}, + // &models.User{}, + // ) + // if err != nil { + // return err + // } + // return nil + //}) if err := m.Migrate(); err != nil { gr.Logger.Errorf("Database migration failed with error. \n Please open a github issue at https://github.com/fastenhealth/fasten-onprem. \n %v", err) diff --git a/frontend/src/app/pages/medical-sources/medical-sources.component.html b/frontend/src/app/pages/medical-sources/medical-sources.component.html index 6d7918ac..5287fb60 100644 --- a/frontend/src/app/pages/medical-sources/medical-sources.component.html +++ b/frontend/src/app/pages/medical-sources/medical-sources.component.html @@ -115,8 +115,8 @@

-
- +
+
diff --git a/go.mod b/go.mod index 4af8062c..4fd5b550 100644 --- a/go.mod +++ b/go.mod @@ -15,7 +15,7 @@ require ( github.com/dave/jennifer v1.6.1 github.com/dominikbraun/graph v0.15.0 github.com/dop251/goja v0.0.0-20230605162241-28ee0ee714f3 - github.com/fastenhealth/fasten-sources v0.5.1 + github.com/fastenhealth/fasten-sources v0.5.2 github.com/fastenhealth/gofhir-models v0.0.6 github.com/gin-gonic/gin v1.9.0 github.com/go-gormigrate/gormigrate/v2 v2.1.1 diff --git a/go.sum b/go.sum index b3dcb7b5..82403db5 100644 --- a/go.sum +++ b/go.sum @@ -101,8 +101,8 @@ github.com/envoyproxy/go-control-plane v0.9.4/go.mod h1:6rpuAdCZL397s3pYoYcLgu1m github.com/envoyproxy/go-control-plane v0.9.7/go.mod h1:cwu0lG7PUMfa9snN8LXBig5ynNVH9qI8YYLbd1fK2po= github.com/envoyproxy/go-control-plane v0.9.9-0.20201210154907-fd9021fe5dad/go.mod h1:cXg6YxExXjJnVBQHBLXeUAgxn2UodCpnH306RInaBQk= github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c= -github.com/fastenhealth/fasten-sources v0.5.1 h1:jbFmaXgwJ+dqkWaSAIRSfQIGFrHC0YFtwci567F7kTo= -github.com/fastenhealth/fasten-sources v0.5.1/go.mod h1:hUQATAu5KrxKbACJoVt4iEKIGnRtmiOmHz+5TLfyiCM= +github.com/fastenhealth/fasten-sources v0.5.2 h1:pZwCOEycFga950ItdRG0wdBsv+FJLjnZr4yghAN8exw= +github.com/fastenhealth/fasten-sources v0.5.2/go.mod h1:hUQATAu5KrxKbACJoVt4iEKIGnRtmiOmHz+5TLfyiCM= github.com/fastenhealth/gofhir-models v0.0.6 h1:yJYYaV1eJtHiGEfA1rXLsyOm/9hIi6s2cGoZzGfW1tM= github.com/fastenhealth/gofhir-models v0.0.6/go.mod h1:xB8ikGxu3bUq2b1JYV+CZpHqBaLXpOizFR0eFBCunis= github.com/fatih/color v1.7.0/go.mod h1:Zm6kSWBoL9eyXnKyktHP6abPY2pDugNf5KwzbycvMj4=