diff --git a/maestro/deployment/repository.go b/maestro/deployment/repository.go index 93f9ead14..9df735aa6 100644 --- a/maestro/deployment/repository.go +++ b/maestro/deployment/repository.go @@ -36,7 +36,21 @@ type repositoryService struct { func (r *repositoryService) FetchAll(ctx context.Context) ([]Deployment, error) { tx := r.db.MustBeginTx(ctx, nil) var deployments []Deployment - err := tx.SelectContext(ctx, &deployments, "SELECT * FROM deployments", nil) + query := ` + SELECT id, + owner_id, + sink_id, + backend, + config, + last_status, + last_status_update, + last_error_message, + last_error_time, + collector_name, + last_collector_deploy_time, + last_collector_stop_time + FROM deployments` + err := tx.SelectContext(ctx, &deployments, query, nil) if err != nil { _ = tx.Rollback() return nil, err @@ -135,8 +149,23 @@ func (r *repositoryService) Remove(ctx context.Context, ownerId string, sinkId s func (r *repositoryService) FindByOwnerAndSink(ctx context.Context, ownerId string, sinkId string) (*Deployment, error) { tx := r.db.MustBeginTx(ctx, nil) var rows []Deployment - err := tx.SelectContext(ctx, &rows, "SELECT * FROM deployments WHERE owner_id = :owner_id AND sink_id = :sink_id", - map[string]interface{}{"owner_id": ownerId, "sink_id": sinkId}) + args := []interface{}{ownerId, sinkId} + query := ` + SELECT id, + owner_id, + sink_id, + backend, + config, + last_status, + last_status_update, + last_error_message, + last_error_time, + collector_name, + last_collector_deploy_time, + last_collector_stop_time + FROM deployments WHERE owner_id = ? AND sink_id = ? + ` + err := tx.SelectContext(ctx, &rows, query, args) if err != nil { _ = tx.Rollback() return nil, err