chore: clean up database schema sync for virtual doctype

Co-authored-by: Chinmay D. Pai <chinmay.pai@zerodha.com>
Signed-off-by: Chinmay D. Pai <chinmay.pai@zerodha.com>
This commit is contained in:
Shridhar Patil 2020-12-23 22:32:11 +05:30 committed by Chinmay D. Pai
parent 7b16837f88
commit 86f9747925
No known key found for this signature in database
GPG key ID: 75507BE256F40CED

View file

@ -30,9 +30,12 @@ class DBTable:
self.get_columns_from_docfields()
def sync(self):
if self.is_new() and not self.meta.get('virtual_doctype'):
if self.meta.get('virtual_doctype'):
# no schema to sync for virtual doctypes
return
if self.is_new():
self.create()
elif not self.meta.get('virtual_doctype'):
else:
frappe.cache().hdel('table_columns', self.table_name)
self.alter()