Skip to content

Commit

Permalink
Fix issue when upgrading maps for fields that no longer exist
Browse files Browse the repository at this point in the history
Fixes #227
  • Loading branch information
Tam committed Dec 18, 2019
1 parent ec71b43 commit 0481264
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
3 changes: 2 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
## [Unreleased] 3.7.6
### Fixed
- Fix issue with getting distance when lat/lng was stored as string (Fixes #230)
- Fix issue with getting distance when lat/lng was stored as string (Fixes #230)
- Fix issue when upgrading maps for fields that no longer exist (Fixes #227)

## 3.7.5 - 2019-12-04
### Added
Expand Down
10 changes: 9 additions & 1 deletion src/migrations/m190712_104805_new_data_format.php
Original file line number Diff line number Diff line change
Expand Up @@ -274,7 +274,15 @@ function ($carry, $row) {
$map->ownerSiteId = $row['siteId'];
$map->fieldId = $mapData['fieldId'];

$field = $fields[$mapData['fieldId']];
$field = @$fields[$mapData['fieldId']];

// Skip if the field no longer exists
if (!$field)
{
echo '- Skipping ' . $map->address . ' (' . $mapData['id'] . ') - Field no longer exists' . PHP_EOL;
continue;
}

$col = $fieldColumnPrefix . $field->handle;

$db->createCommand()
Expand Down

0 comments on commit 0481264

Please sign in to comment.