[hotfix] patches and varchar length check
This commit is contained in:
parent
9b5811ea35
commit
70c58ccb81
3 changed files with 5 additions and 4 deletions
|
|
@ -106,7 +106,7 @@ class DbTable:
|
|||
|
||||
try:
|
||||
# check for truncation
|
||||
max_length = frappe.db.sql("""select max(length(`{fieldname}`)) from `tab{doctype}`"""\
|
||||
max_length = frappe.db.sql("""select max(char_length(`{fieldname}`)) from `tab{doctype}`"""\
|
||||
.format(fieldname=col.fieldname, doctype=self.doctype))
|
||||
|
||||
except MySQLdb.OperationalError, e:
|
||||
|
|
|
|||
|
|
@ -11,6 +11,7 @@ execute:frappe.reload_doc('core', 'doctype', 'version') #2014-02-21
|
|||
execute:frappe.reload_doc('email', 'doctype', 'email_alert') #2014-07-15
|
||||
execute:frappe.reload_doc('desk', 'doctype', 'todo') #2014-12-31-1
|
||||
execute:frappe.reload_doc('custom', 'doctype', 'property_setter') #2014-12-31-1
|
||||
execute:frappe.reload_doctype("File") # 2015-10-19
|
||||
execute:frappe.db.sql("alter table `tabSessions` modify `user` varchar(255), engine=InnoDB")
|
||||
execute:frappe.db.sql("delete from `tabDocField` where parent='0'")
|
||||
frappe.patches.v4_0.change_varchar_length
|
||||
|
|
@ -96,4 +97,4 @@ execute:frappe.db.sql("delete from tabSessions where user is null")
|
|||
frappe.patches.v6_2.rename_backup_manager
|
||||
execute:frappe.delete_doc("DocType", "Backup Manager")
|
||||
frappe.patches.v6_4.reduce_varchar_length
|
||||
frappe.patches.v6_4.rename_bengali_language
|
||||
frappe.patches.v6_4.rename_bengali_language
|
||||
|
|
|
|||
|
|
@ -12,12 +12,12 @@ def execute():
|
|||
if not column_type.startswith("varchar"):
|
||||
continue
|
||||
|
||||
max_length = frappe.db.sql("""select max(length(`{fieldname}`)) from `tab{doctype}`"""\
|
||||
max_length = frappe.db.sql("""select max(char_length(`{fieldname}`)) from `tab{doctype}`"""\
|
||||
.format(fieldname=fieldname, doctype=doctype))
|
||||
|
||||
max_length = max_length[0][0] if max_length else None
|
||||
|
||||
if max_length and max_length > 140:
|
||||
if max_length and 140 < max_length <= 255:
|
||||
print "setting length of '{fieldname}' in '{doctype}' as {length}".format(
|
||||
fieldname=fieldname, doctype=doctype, length=max_length)
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue