Skip to content

Commit

Permalink
Fixed v5 field value bug
Browse files Browse the repository at this point in the history
  • Loading branch information
brandonkelly committed Apr 3, 2024
1 parent 3008e3c commit b0f048d
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
- Fixed a bug where system icons whose names ended in numbers weren’t displaying. ([#14740](https://github.com/craftcms/cms/issues/14740))
- Fixed an error that could occur when creating a passkey. ([#14745](https://github.com/craftcms/cms/issues/14745))
- Fixed a bug where the “Utilities” global nav item could get two badge counts.
- Fixed a bug where custom fields whose previous types were missing would lose their values when updating to Craft 5.

## 5.0.0 - 2024-03-26

Expand Down
9 changes: 8 additions & 1 deletion src/migrations/BaseContentRefactorMigration.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
use craft\db\Query;
use craft\db\Table;
use craft\fieldlayoutelements\CustomField;
use craft\fields\MissingField;
use craft\helpers\ArrayHelper;
use craft\helpers\Db;
use craft\helpers\Json;
Expand Down Expand Up @@ -118,7 +119,13 @@ protected function updateElements(

foreach ($fieldColumns as $layoutElementUid => $column) {
$field = $fieldsByUid[$layoutElementUid];
$dbType = $field::dbType();

if ($field instanceof MissingField) {
// Figure it out from the actual DB column
$dbType = $contentTableSchema->getColumn($column)?->dbType;
} else {
$dbType = $field::dbType();
}

if (is_array($column)) {
/** @var array $dbType */
Expand Down

0 comments on commit b0f048d

Please sign in to comment.