Add is unique in migration v2 + refactor inferDeletionFromMissingEntities (#15070)
## Goal - inferDeletionFromMissingEntities is now a map instead of a single bool, allowing us to parameterise it based on the entity we want to compare - Adding index creation/update when field isUnique is set to true and index deletion when isUnique is false (for now) close https://github.com/twentyhq/core-team-issues/issues/1346
This commit is contained in:
+12
-13
@@ -1,15 +1,14 @@
|
||||
import { CustomException } from 'src/utils/custom-exception';
|
||||
import {
|
||||
appendCommonExceptionCode,
|
||||
CustomException,
|
||||
} from 'src/utils/custom-exception';
|
||||
|
||||
export class FlatEntityMapsException extends CustomException {
|
||||
code: FlatEntityMapsExceptionCode;
|
||||
export class FlatEntityMapsException extends CustomException<
|
||||
keyof typeof FlatEntityMapsExceptionCode
|
||||
> {}
|
||||
|
||||
constructor(message: string, code: FlatEntityMapsExceptionCode) {
|
||||
super(message, code);
|
||||
}
|
||||
}
|
||||
|
||||
export enum FlatEntityMapsExceptionCode {
|
||||
ENTITY_ALREADY_EXISTS = 'ENTITY_ALREADY_EXISTS',
|
||||
ENTITY_NOT_FOUND = 'ENTITY_NOT_FOUND',
|
||||
ENTITY_MALFORMED = 'ENTITY_MALFORMED',
|
||||
}
|
||||
export const FlatEntityMapsExceptionCode = appendCommonExceptionCode({
|
||||
ENTITY_ALREADY_EXISTS: 'ENTITY_ALREADY_EXISTS',
|
||||
ENTITY_NOT_FOUND: 'ENTITY_NOT_FOUND',
|
||||
ENTITY_MALFORMED: 'ENTITY_MALFORMED',
|
||||
} as const);
|
||||
|
||||
Reference in New Issue
Block a user