fix: do not remove tables if array is empty

This commit is contained in:
Marc-Roig 2023-04-28 11:57:28 +02:00
parent e88eee0ecf
commit c20f16e930
No known key found for this signature in database
GPG Key ID: FB4E2C43A0BEE249

View File

@ -124,6 +124,9 @@ const persistTablesWithPrefix = async (tableNamePrefix) => {
const removePersistedTablesWithSuffix = async (tableNameSuffix) => {
const tableNameRegex = new RegExp(`.*${tableNameSuffix}$`);
const tableNames = await findTables({ strapi }, tableNameRegex);
if (!tableNames.length) {
return;
}
await removePersistedTables({ strapi }, tableNames);
};