[Followup] Fix defaultValue with enum options update in migration v2 integration test + polish (#15300)

# Introduction
Followup of https://github.com/twentyhq/twenty/pull/15286

- Polish replacing sorting by conditional filter and push
- Integration test
This commit is contained in:
Paul Rastoin
2025-10-23 17:57:41 +02:00
committed by GitHub
parent 4e767799c6
commit 7edfe4bc7a
4 changed files with 278 additions and 5 deletions
@@ -156,10 +156,12 @@ export class UpdateFieldActionHandlerService extends WorkspaceMigrationRunnerAct
let wasDefaultValueHandledByEnumUpdate = false;
const sortedUpdatesWithDefaultValuesUpdateLast = [...updates].sort(
(a, b) =>
+(a.property === 'defaultValue') - +(b.property === 'defaultValue'),
);
const sortedUpdatesWithDefaultValuesUpdateLast = hasDefaultValueUpdate
? [
...updates.filter((update) => update.property !== 'defaultValue'),
defaultValueUpdate,
]
: updates;
for (const update of sortedUpdatesWithDefaultValuesUpdateLast) {
if (isPropertyUpdate(update, 'name')) {