選択できるのは25トピックまでです。 トピックは、先頭が英数字で、英数字とダッシュ('-')を使用した35文字以内のものにしてください。
 
 
 
 
 
 

32 行
1.1 KiB

  1. import frappe
  2. from frappe.model import rename_field
  3. def execute():
  4. tables = frappe.db.sql_list("show tables")
  5. for doctype in ("Website Sitemap", "Website Sitemap Config"):
  6. if "tab{}".format(doctype) in tables:
  7. frappe.delete_doc("DocType", doctype, force=1)
  8. frappe.db.sql("drop table `tab{}`".format(doctype))
  9. if "tabWebsite Route Permission" not in tables:
  10. frappe.rename_doc("DocType", "Website Sitemap Permission", "Website Route Permission", force=True)
  11. for d in ("Blog Category", "Blog Post", "Web Page", "Website Group"):
  12. frappe.reload_doc("website", "doctype", frappe.scrub(d))
  13. rename_field_if_exists(d, "parent_website_sitemap", "parent_website_route")
  14. frappe.reload_doc("website", "doctype", "website_route_permission")
  15. rename_field_if_exists("Website Route Permission", "website_sitemap", "website_route")
  16. for d in ("blog_category", "blog_post", "web_page", "website_group", "post", "user_vote"):
  17. frappe.reload_doc("website", "doctype", d)
  18. def rename_field_if_exists(doctype, old_fieldname, new_fieldname):
  19. try:
  20. rename_field(doctype, old_fieldname, new_fieldname)
  21. except Exception, e:
  22. if e.args[0] != 1054:
  23. raise