From 9b2283092ec7f84f0fe8e884572be9e56f6ae07c Mon Sep 17 00:00:00 2001 From: Ankush Menat Date: Thu, 15 Dec 2022 14:11:26 +0530 Subject: [PATCH] test: another test case for index duplication --- frappe/tests/test_db_update.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/frappe/tests/test_db_update.py b/frappe/tests/test_db_update.py index 0140bea113..21ef16fa48 100644 --- a/frappe/tests/test_db_update.py +++ b/frappe/tests/test_db_update.py @@ -128,6 +128,14 @@ class TestDBUpdate(FrappeTestCase): doctype.save() self.check_unique_indexes(doctype.name, field) + # New column with a unique index + # This works because index name is same as fieldname. + new_field = frappe.copy_doc(doctype.fields[0]) + new_field.fieldname = "duplicate_field" + doctype.append("fields", new_field) + doctype.save() + self.check_unique_indexes(doctype.name, new_field.fieldname) + doctype.delete() frappe.db.commit()