Don't delete columns for alias fields

Fixes #4802
This commit is contained in:
rijkvanzanten
2021-04-05 17:01:19 -04:00
parent 9859212253
commit eb79c00756

View File

@@ -298,7 +298,11 @@ export class FieldsService {
await this.knex('directus_fields').delete().where({ collection, field });
if (this.schema.collections[collection] && field in this.schema.collections[collection].fields) {
if (
this.schema.collections[collection] &&
field in this.schema.collections[collection].fields &&
this.schema.collections[collection].fields[field].alias === false
) {
await this.knex.schema.table(collection, (table) => {
table.dropColumn(field);
});