mirror of
https://github.com/twentyhq/twenty.git
synced 2024-12-26 13:31:45 +03:00
Fix consistency issuesin relation onDelete behavior while creating a new relation (#4372)
* Fix consistency issuesin relation onDelete behavior while creating a new relation * Fix according to review
This commit is contained in:
parent
92aa0bd888
commit
d2e2e50d8a
@ -9,7 +9,6 @@ import { ObjectTasks } from '@/activities/tasks/components/ObjectTasks';
|
||||
import { Timeline } from '@/activities/timeline/components/Timeline';
|
||||
import { TimelineQueryEffect } from '@/activities/timeline/components/TimelineQueryEffect';
|
||||
import { ActivityTargetableObject } from '@/activities/types/ActivityTargetableEntity';
|
||||
import { useObjectMetadataItem } from '@/object-metadata/hooks/useObjectMetadataItem';
|
||||
import { CoreObjectNameSingular } from '@/object-metadata/types/CoreObjectNameSingular';
|
||||
import {
|
||||
IconCalendarEvent,
|
||||
@ -65,11 +64,6 @@ export const ShowPageRightContainer = ({
|
||||
const { getActiveTabIdState } = useTabList(TAB_LIST_COMPONENT_ID);
|
||||
const activeTabId = useRecoilValue(getActiveTabIdState());
|
||||
|
||||
const { objectMetadataItem: targetableObjectMetadataItem } =
|
||||
useObjectMetadataItem({
|
||||
objectNameSingular: targetableObject.targetObjectNameSingular,
|
||||
});
|
||||
|
||||
const shouldDisplayCalendarTab = useIsFeatureEnabled('IS_CALENDAR_ENABLED');
|
||||
const shouldDisplayEmailsTab =
|
||||
(emails &&
|
||||
@ -101,7 +95,6 @@ export const ShowPageRightContainer = ({
|
||||
title: 'Files',
|
||||
Icon: IconPaperclip,
|
||||
hide: !notes,
|
||||
disabled: targetableObjectMetadataItem.isCustom,
|
||||
},
|
||||
{
|
||||
id: 'emails',
|
||||
|
@ -397,6 +397,7 @@ export class ObjectMetadataService extends TypeOrmQueryService<ObjectMetadataEnt
|
||||
createdObjectMetadata,
|
||||
),
|
||||
referencedTableColumnName: 'id',
|
||||
onDelete: RelationOnDeleteAction.CASCADE,
|
||||
},
|
||||
],
|
||||
},
|
||||
|
@ -26,6 +26,7 @@ import { generateMigrationName } from 'src/metadata/workspace-migration/utils/ge
|
||||
import {
|
||||
RelationMetadataEntity,
|
||||
RelationMetadataType,
|
||||
RelationOnDeleteAction,
|
||||
} from './relation-metadata.entity';
|
||||
|
||||
@Injectable()
|
||||
@ -209,6 +210,7 @@ export class RelationMetadataService extends TypeOrmQueryService<RelationMetadat
|
||||
isUnique:
|
||||
relationMetadataInput.relationType ===
|
||||
RelationMetadataType.ONE_TO_ONE,
|
||||
onDelete: RelationOnDeleteAction.SET_NULL,
|
||||
},
|
||||
],
|
||||
},
|
||||
|
@ -4,7 +4,7 @@ export const convertOnDeleteActionToOnDelete = (
|
||||
onDeleteAction: RelationOnDeleteAction | undefined,
|
||||
): 'CASCADE' | 'SET NULL' | 'RESTRICT' | 'NO ACTION' | undefined => {
|
||||
if (!onDeleteAction) {
|
||||
return;
|
||||
return 'SET NULL';
|
||||
}
|
||||
|
||||
switch (onDeleteAction) {
|
||||
|
Loading…
Reference in New Issue
Block a user