[fix] don't unique text fields

This commit is contained in:
Rushabh Mehta 2015-05-07 17:48:54 +05:30
parent 45ae2998be
commit a0b27ae2d7
2 changed files with 2 additions and 2 deletions

View file

@ -273,7 +273,7 @@ def validate_fields(meta):
frappe.throw(_("Precision should be between 1 and 6"))
def check_unique_and_text(d):
if d.unique and d.fieldtype in ("Text", "Long Text", "Small Text", "Code", "Text Editor"):
if getattr(d, "unique", False) and d.fieldtype in ("Text", "Long Text", "Small Text", "Code", "Text Editor"):
frappe.throw(_("Fieldtype {0} for {1} cannot be unique").format(d.fieldtype, d.label))
if d.search_index and d.fieldtype in ("Text", "Long Text", "Small Text", "Code", "Text Editor"):

View file

@ -259,7 +259,7 @@ class DbColumn:
and not self.default.startswith(":") and column_def not in ('text', 'longtext'):
column_def += ' default "' + self.default.replace('"', '\"') + '"'
if self.unique and column_def not in ('text', 'longtext'):
if self.unique and (column_def not in ('text', 'longtext')):
column_def += ' unique'
return column_def