Skip to content

Commit

Permalink
fix: filter components by agent when persisting them
Browse files Browse the repository at this point in the history
  • Loading branch information
yashmehrotra committed Jan 18, 2024
1 parent bc5aeef commit f21681d
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion pkg/db/topology.go
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,7 @@ func DeleteInlineCanariesForComponent(db *gorm.DB, componentID string) error {
}

func GetActiveComponentsIDsOfTopology(db *gorm.DB, topologyID string) (compIDs []uuid.UUID, err error) {
if err := db.Table("components").Where("deleted_at is NULL and topology_id = ?", topologyID).Select("id").Find(&compIDs).Error; err != nil {
if err := db.Table("components").Where("deleted_at is NULL AND topology_id = ?", topologyID).Select("id").Find(&compIDs).Error; err != nil {
return nil, err
}
return
Expand Down
2 changes: 1 addition & 1 deletion pkg/system_api.go
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ type Component struct {

func (component *Component) FindExisting(db *gorm.DB) (*models.Component, error) {
var existing models.Component
tx := db.Model(component).Select("id", "deleted_at")
tx := db.Model(component).Select("id", "deleted_at").Where("agent_id = ?", uuid.Nil)
if component.ID == uuid.Nil {
if component.ParentId == nil {
tx = tx.Find(&existing, "name = ? AND type = ? and parent_id is NULL", component.Name, component.Type)
Expand Down

0 comments on commit f21681d

Please sign in to comment.