mirror of
https://github.com/directus/directus.git
synced 2026-04-25 03:00:53 -04:00
Create meta row if it doesn't exist yet on update field
This commit is contained in:
@@ -246,13 +246,20 @@ export default class FieldsService {
|
||||
.from('directus_fields')
|
||||
.where({ collection, field: field.field })
|
||||
.first();
|
||||
if (!record) throw new FieldNotFoundException(collection, field.field);
|
||||
|
||||
await this.itemsService.update({
|
||||
...field.meta,
|
||||
collection: collection,
|
||||
field: field.field,
|
||||
}, record.id);
|
||||
if (record) {
|
||||
await this.itemsService.update({
|
||||
...field.meta,
|
||||
collection: collection,
|
||||
field: field.field,
|
||||
}, record.id);
|
||||
} else {
|
||||
await this.itemsService.create({
|
||||
...field.meta,
|
||||
collection: collection,
|
||||
field: field.field,
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
return field.field;
|
||||
|
||||
Reference in New Issue
Block a user