Fix seeds (#7543)
- Fixing seeds after introducing the requirement for non-nullable fields to have a default value (https://github.com/twentyhq/twenty/pull/7522). - Empty string needs to be considered a valid default value
This commit is contained in:
@ -15,6 +15,7 @@ export const getDevSeedCompanyCustomFields = (
|
||||
icon: 'IconAdCircle',
|
||||
isActive: true,
|
||||
isNullable: false,
|
||||
defaultValue: "''",
|
||||
objectMetadataId,
|
||||
},
|
||||
{
|
||||
@ -99,6 +100,13 @@ export const getDevSeedPeopleCustomFields = (
|
||||
icon: 'IconBrandWhatsapp',
|
||||
isActive: true,
|
||||
isNullable: false,
|
||||
defaultValue: [
|
||||
{
|
||||
primaryPhoneNumber: '',
|
||||
primaryPhoneCountryCode: '',
|
||||
additionalPhones: {},
|
||||
},
|
||||
],
|
||||
objectMetadataId,
|
||||
},
|
||||
{
|
||||
|
||||
@ -55,6 +55,7 @@ import { TwentyORMGlobalManager } from 'src/engine/twenty-orm/twenty-orm-global.
|
||||
import { computeObjectTargetTable } from 'src/engine/utils/compute-object-target-table.util';
|
||||
import { WorkspaceMigrationRunnerService } from 'src/engine/workspace-manager/workspace-migration-runner/workspace-migration-runner.service';
|
||||
import { ViewFieldWorkspaceEntity } from 'src/modules/view/standard-objects/view-field.workspace-entity';
|
||||
import { isDefined } from 'src/utils/is-defined';
|
||||
|
||||
import { FieldMetadataValidationService } from './field-metadata-validation.service';
|
||||
import {
|
||||
@ -746,7 +747,7 @@ export class FieldMetadataService extends TypeOrmQueryService<FieldMetadataEntit
|
||||
}
|
||||
|
||||
if (!fieldMetadataInput.isNullable) {
|
||||
if (!fieldMetadataInput.defaultValue) {
|
||||
if (!isDefined(fieldMetadataInput.defaultValue)) {
|
||||
throw new FieldMetadataException(
|
||||
'Default value is required for non nullable fields',
|
||||
FieldMetadataExceptionCode.INVALID_FIELD_INPUT,
|
||||
|
||||
Reference in New Issue
Block a user