import xhiveframework


def execute():

	# Erase all default item manufacturers that dont exist.
	item = xhiveframework.qb.DocType("Item")
	manufacturer = xhiveframework.qb.DocType("Manufacturer")

	(
		xhiveframework.qb.update(item)
		.set(item.default_item_manufacturer, None)
		.left_join(manufacturer)
		.on(item.default_item_manufacturer == manufacturer.name)
		.where(manufacturer.name.isnull() & item.default_item_manufacturer.isnotnull())
	).run()
