code: func (s *releasesService) Create(ctx context.Context, db *gorm.DB, r *Release) (*Release, error) {
  	// Lock all releases for the given application to ensure that the
  	// release version is updated automically.
  	if err := db.Exec(`select 1 from releases where app_id = ? for update`, r.App.ID).Error; err != nil {
  		return r, err
  	}
  
  	// During rollbacks, we can just provide the existing Formation for the
  	// old release. For new releases, we need to create a new formation by
  	// merging the formation from the extracted Procfile, and the Formation
  	// from the existing release.
  	if r.Formation == nil {
  		if err := buildFormation(db, r); err != nil {
  			return r, err
  		}
  	}
  
  	return releasesCreate(db, r)
  }
docs: // Create creates a new release.