Add comment

This commit is contained in:
rijkvanzanten
2020-09-23 19:14:11 -04:00
parent 5bd7177d5a
commit 6d9809254a

View File

@@ -179,6 +179,7 @@ export class FieldsService {
throw new ForbiddenException('Only admins can perform this action.');
}
// Check if field already exists, either as a column, or as a row in directus_fields
if (await this.schemaInspector.hasColumn(collection, field.field)) {
throw new InvalidPayloadException(`Field "${field.field}" already exists in collection "${collection}"`);
} else if (!!await this.knex.select('id').from('directus_fields').where({ collection, field: field.field }).first()) {