The frappe.db.delete does not seems to work

I am trying to delete all records in the database that have the deleting company name doc.name. i am trying this way to ensure all datas are removed connected to one company and without any permission problems

doctypes = frappe.get_all('DocType', fields=['name'])

# Access doctype names
for doctype in doctypes:
    doctype_name = doctype.get('name')

# Execute deletion query for all doctypes
frappe.db.delete(doctype_name, {
  "company": doc.name,
},ignore_permission= True)

frappe.msgprint(_("Records for company '{}' deleted successfully.").format(doc.name))

And i got this error

AttributeError: module has no attribute ‘delete’

Database api has no param as ignore_permission.

Try this code:

doctypes = frappe.get_all('DocType', fields=['name'])

# Access doctype names
for doctype in doctypes:
    doctype_name = doctype.get('name')

    # Execute deletion query for all doctypes
    frappe.db.delete(doctype_name, {
      "company": doc.name,
    })

frappe.msgprint(_("Records for company '{}' deleted successfully.").format(doc.name))