def update_child_table(self, fieldname, df=None):
		rows = []
		if not df:
			df = self.meta.get_field(fieldname)

		for d in self.get(df.fieldname):
			d.db_update()
			rows.append(d.name)

		if df.options in (self.flags.ignore_children_type or []):
			# do not delete rows for this because of flags
			# hack for docperm :(
			return

		if rows:
			# delete rows that do not match the ones in the
			# document
			frappe.db.sql("""delete from `tab%s` where parent=%s and parenttype=%s and
				name not in (%s)""" % (df.options, '%s', '%s', ','.join(['%s'] * len(rows))),
					tuple([self.name, self.doctype] + rows))
		else:
			# no rows found, delete all rows
			frappe.db.sql("""delete from `tab%s` where parent=%s and parenttype=%s""" \
				% (df.options, '%s', '%s'), (self.name, self.doctype))
If a file with the selected name already exists in the target folder,
dataset/ETHPy150Open frappe/frappe/frappe/model/document.py/Document.update_child_table--crossover with--dataset/ETHPy150Open jeffwidman/flask-uploads/flask_uploads.py/UploadSet.resolve_conflict