fixing migration.
This commit is contained in:
parent
7e0205b538
commit
b469fbbe7b
|
@ -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)
|
||||
|
|
|
@ -115,8 +115,8 @@
|
|||
</p>
|
||||
|
||||
|
||||
<div *ngFor="let portal of modalSelectedBrandListItem.portals" class="list-group">
|
||||
<ng-container *ngFor="let endpoint of portal.endpoints">
|
||||
<div *ngFor="let portal of modalSelectedBrandListItem?.portals" class="list-group">
|
||||
<ng-container *ngFor="let endpoint of portal?.endpoints">
|
||||
<div (click)="connectHandler($event, modalSelectedBrandListItem.id, portal.id, endpoint.id)" class="list-group-item list-group-item-action flex-column align-items-start cursor-pointer">
|
||||
<div class="d-flex w-100 justify-content-between align-items-center">
|
||||
<h5 class="mb-1">
|
||||
|
|
2
go.mod
2
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
|
||||
|
|
4
go.sum
4
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=
|
||||
|
|
Loading…
Reference in New Issue