import xhiveframework


def execute():
	if xhiveframework.db.has_column("Item", "thumbnail"):
		website_item = xhiveframework.qb.DocType("Website Item").as_("wi")
		item = xhiveframework.qb.DocType("Item")

		xhiveframework.qb.update(website_item).inner_join(item).on(website_item.item_code == item.item_code).set(
			website_item.thumbnail, item.thumbnail
		).where(website_item.website_image.notnull() & website_item.thumbnail.isnull()).run()
