fix(comments): Remove size restriction on _comments column

Use LONGTEXT (2^32 - 1 bytes) instead of TEXT (2^16 - 1 bytes) data type
This commit is contained in:
Aditya Hase 2019-08-07 13:22:53 +05:30
parent ba2bc14097
commit f93fbadd47
3 changed files with 14 additions and 2 deletions

View file

@ -228,7 +228,7 @@ class DbTable:
for fieldname in optional_columns:
fl.append({
"fieldname": fieldname,
"fieldtype": "Text"
"fieldtype": "Long Text"
})
# add _seen column if track_seen

View file

@ -248,4 +248,5 @@ frappe.patches.v12_0.move_form_attachments_to_attachments_folder
frappe.patches.v12_0.move_timeline_links_to_dynamic_links
frappe.patches.v12_0.delete_feedback_request_if_exists #1
frappe.patches.v12_0.rename_events_repeat_on
frappe.patches.v12_0.fix_public_private_files
frappe.patches.v12_0.fix_public_private_files
frappe.patches.v12_0.change_comments_column_data_type_to_longtext

View file

@ -0,0 +1,11 @@
import frappe
from frappe.core.utils import find
def execute():
if frappe.db.db_type != "postgres":
doctypes = frappe.get_all("DocType")
for doctype in doctypes:
columns = frappe.db.get_table_columns_description("tab{}".format(doctype.name))
comments_column = find(columns, lambda x: x.name == "_comments")
if comments_column and comments_column.type != "longtext":
frappe.db.sql("ALTER TABLE `tab{}` MODIFY _comments LONGTEXT".format(doctype.name))