Fallback to default value when migrating value from enum (#6517)
When migrating the option values of a select type, if the field is non nullable (for now, only available for opportunity's "stage" standard field), we fallback to the (potentially updated) default value instead of nullifying the value to avoid getting a database error. --------- Co-authored-by: Charles Bochet <charles@twenty.com>
This commit is contained in:
@ -34,6 +34,7 @@ export const buildMigrationsForCustomObjectRelations = (
|
||||
}),
|
||||
columnType: 'uuid',
|
||||
isNullable: true,
|
||||
defaultValue: null,
|
||||
} satisfies WorkspaceMigrationColumnCreate,
|
||||
],
|
||||
},
|
||||
@ -64,6 +65,7 @@ export const buildMigrationsForCustomObjectRelations = (
|
||||
}),
|
||||
columnType: 'uuid',
|
||||
isNullable: true,
|
||||
defaultValue: null,
|
||||
} satisfies WorkspaceMigrationColumnCreate,
|
||||
],
|
||||
},
|
||||
@ -94,6 +96,7 @@ export const buildMigrationsForCustomObjectRelations = (
|
||||
}),
|
||||
columnType: 'uuid',
|
||||
isNullable: true,
|
||||
defaultValue: null,
|
||||
} satisfies WorkspaceMigrationColumnCreate,
|
||||
],
|
||||
},
|
||||
@ -124,6 +127,7 @@ export const buildMigrationsForCustomObjectRelations = (
|
||||
}),
|
||||
columnType: 'uuid',
|
||||
isNullable: true,
|
||||
defaultValue: null,
|
||||
} satisfies WorkspaceMigrationColumnCreate,
|
||||
],
|
||||
},
|
||||
@ -154,6 +158,7 @@ export const buildMigrationsForCustomObjectRelations = (
|
||||
}),
|
||||
columnType: 'uuid',
|
||||
isNullable: true,
|
||||
defaultValue: null,
|
||||
} satisfies WorkspaceMigrationColumnCreate,
|
||||
],
|
||||
},
|
||||
@ -184,6 +189,7 @@ export const buildMigrationsForCustomObjectRelations = (
|
||||
}),
|
||||
columnType: 'uuid',
|
||||
isNullable: true,
|
||||
defaultValue: null,
|
||||
} satisfies WorkspaceMigrationColumnCreate,
|
||||
],
|
||||
},
|
||||
@ -211,6 +217,7 @@ export const buildMigrationsForCustomObjectRelations = (
|
||||
columnName: 'position',
|
||||
columnType: 'float',
|
||||
isNullable: true,
|
||||
defaultValue: null,
|
||||
} satisfies WorkspaceMigrationColumnCreate,
|
||||
],
|
||||
} satisfies WorkspaceMigrationTableAction,
|
||||
@ -224,6 +231,7 @@ export const buildMigrationsForCustomObjectRelations = (
|
||||
columnName: 'name',
|
||||
columnType: 'text',
|
||||
defaultValue: "'Untitled'",
|
||||
isNullable: false,
|
||||
} satisfies WorkspaceMigrationColumnCreate,
|
||||
],
|
||||
} satisfies WorkspaceMigrationTableAction,
|
||||
|
||||
Reference in New Issue
Block a user