Contentful logo

Contentful Community

Checking for content type before delete using deleteContentType

// Example of payload validation:
module.exports = function(migration) {
  const barcelonaExist = migration.editContentType("barcelona");
  if (barcelonaExist) {
    migration.deleteContentType("barcelona");
  }
};

here is the link which I am following.

I want to delete barcelona only if it exist.
In above example migration.deleteContentType(“barcelona”) getting called every time.

any help would be appreciated.