mirror of
https://github.com/directus/directus.git
synced 2026-04-25 03:00:53 -04:00
add one_field for corresponding m2o relations of file relation (#13272)
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
import { StateUpdates, State, HelperFunctions } from '../types';
|
||||
import { set } from 'lodash';
|
||||
import { setRelatedOneFieldForCorrespondingField } from './m2o';
|
||||
|
||||
export function applyChanges(updates: StateUpdates, state: State, helperFn: HelperFunctions) {
|
||||
const { hasChanged, getCurrent } = helperFn;
|
||||
@@ -13,6 +14,10 @@ export function applyChanges(updates: StateUpdates, state: State, helperFn: Help
|
||||
updateRelationField(updates);
|
||||
}
|
||||
|
||||
if (hasChanged('fields.corresponding')) {
|
||||
setRelatedOneFieldForCorrespondingField(updates);
|
||||
}
|
||||
|
||||
if (hasChanged('field.schema.is_nullable')) {
|
||||
if (updates.field?.schema?.is_nullable === false && getCurrent('relations.m2o.schema.on_delete') === 'SET NULL') {
|
||||
set(updates, 'relations.m2o.schema.on_delete', 'NO ACTION');
|
||||
|
||||
Reference in New Issue
Block a user