Skip to content

Conversation

davechan813
Copy link
Collaborator

Fixed #455. Call UpdateProject with default setting when new environment provisioned.

@codecov
Copy link

codecov bot commented Jul 16, 2019

Codecov Report

Merging #492 into master will decrease coverage by 0.16%.
The diff coverage is 0%.

@@            Coverage Diff             @@
##           master     #492      +/-   ##
==========================================
- Coverage    50.5%   50.33%   -0.17%     
==========================================
  Files          74       74              
  Lines        8388     8415      +27     
==========================================
  Hits         4236     4236              
- Misses       3641     3667      +26     
- Partials      511      512       +1

@davechan813 davechan813 added the S/Review Status: Please review label Jul 16, 2019
@@ -297,6 +297,36 @@ func (r *ProjectResolverMutation) UpdateProjectEnvironments(ctx context.Context,
EnvironmentID: environment.Model.ID,
ProjectID: project.Model.ID,
}

// Save branch if this is a new environment
if r.DB.Where("environment_id = ? and project_id = ?", environment.Model.ID, project.Model.ID).Find(&projectEnvironment).RecordNotFound() {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you please use gorm.IsRecordNotFoundError (i think that's the right function)
to determine if it is a RecordNotFound error or not? If it's not a simple record not found, like there being a DB constraint or some sort of other error, we should log it.

You would do if err := r.DB.Where(query).Find(&model).Error; err != nil and then if gorm.IsRecordNotFoundError(err)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S/Review Status: Please review
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Provisioning new environment in CodeAmp
3 participants