File - Migrate avatarUrl > avatarFile on person (data migration + logic) + Attachment data migration (#17752)
- Migration command
- Check IS_FILES_FIELD_MIGRATED:false
- Check or create avatarFile field
- Fetch all people with avatarUrl
- Move (Copy/move) file in storage
- Create core.file record
- Update person record
- bonus : attachment migration : fullPath > file (same logic)
- BE logic
- Add avatarFile field on person
- FE logic
- Adapt logic to upload on/display avatarFile data
The whole imageIdentifier logic will be done later
This commit is contained in:
+8
@@ -134,6 +134,14 @@ export class FilesFieldSync {
|
||||
return null;
|
||||
}
|
||||
|
||||
const isModifyingFilesField = filesFields.some((filesField) =>
|
||||
isDefined(updatePayload[filesField.name as keyof typeof updatePayload]),
|
||||
);
|
||||
|
||||
if (!isModifyingFilesField) {
|
||||
return null;
|
||||
}
|
||||
|
||||
if (existingRecords.length !== 1) {
|
||||
throw new TwentyORMException(
|
||||
`Cannot update multiple records with files field at once`,
|
||||
|
||||
Reference in New Issue
Block a user