Merge pull request #8111 from adityahase/fix-comments

fix(comments): Remove size restriction on _comments column
This commit is contained in:
mergify[bot] 2019-08-07 09:41:07 +00:00 committed by GitHub
commit 6a9b21c2d4
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
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))