Skip to content

Commit

Permalink
Fix #524 Remove unused fields from Organisation collection
Browse files Browse the repository at this point in the history
  • Loading branch information
albinpa authored and georgepadayatti committed Nov 14, 2023
1 parent c7579be commit 3919ad9
Show file tree
Hide file tree
Showing 2 changed files with 58 additions and 408 deletions.
25 changes: 25 additions & 0 deletions internal/migrate/migrate.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ func Migrate() {
migrateTimestampInApiKeyCollection()
migrateOrganisationIdInIDPCollection()
migrateExpiryTimestampInApiKeyCollection()
migrateUnusedFieldsFromOrganistaionColloction()
}

func migrateThirdPartyDataSharingToTrueInPolicyCollection() {
Expand Down Expand Up @@ -177,3 +178,27 @@ func migrateExpiryTimestampInApiKeyCollection() {
}

}

func migrateUnusedFieldsFromOrganistaionColloction() {

orgCollection := org.Collection()

filter := bson.M{}
update := bson.M{"$unset": bson.M{"jurisdiction": 1,
"disclosure": 1,
"restriction": 1,
"shared3pp": 1,
"templates": 1,
"purposes": 1,
"hlcsupport": 1,
"dataretention": 1,
"identityproviderrepresentation": 1,
"keycloakopenidclient": 1,
"externalidentityprovideravailable": 1,
}}

_, err := orgCollection.UpdateMany(context.TODO(), filter, update)
if err != nil {
fmt.Println(err)
}
}
Loading

0 comments on commit 3919ad9

Please sign in to comment.