Skip to content

Commit

Permalink
Merge pull request #235 from angrybrad/master
Browse files Browse the repository at this point in the history
Fixed a migration error that could occur when updating to Craft 4
  • Loading branch information
sebastian-lenz authored Aug 18, 2022
2 parents 23fb11f + 758c5e5 commit 1b011d7
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.MD
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
# Release Notes for Typed Link Field

## Unreleased
- Fix: Fixed a migration error that could occur when updating to Craft 4. (see https://github.com/sebastian-lenz/craft-linkfield/issues/230)

## 2.1.4
- Fix: Respect the default link type setting in matrix fields (see https://github.com/sebastian-lenz/craft-linkfield/issues/221)
- Fix: Element query executed before Craft is fully initialized (see https://github.com/sebastian-lenz/craft-linkfield/issues/231)
Expand Down
6 changes: 4 additions & 2 deletions src/migrations/m190417_202153_migrateDataToTable.php
Original file line number Diff line number Diff line change
Expand Up @@ -132,9 +132,11 @@ private function updateLinkField(LinkField $field, string $table, string $handle
}
};

// Make sure the rows actually exist in the elements table.
$rows = (new Query())
->select(['elementId', 'siteId', $columnName])
->from($table)
->select(['t.elementId', 't.siteId', 't.'.$columnName])
->from(['t' => $table])
->innerJoin(['e' => Table::ELEMENTS], '[[t.elementId]] = [[e.id]]')
->all();

foreach ($rows as $row) {
Expand Down

0 comments on commit 1b011d7

Please sign in to comment.