浏览代码

fix: correctly compute doctype name from table name

version-14
Ankush Menat 3 年前
父节点
当前提交
e58c557e12
共有 3 个文件被更改,包括 4 次插入4 次删除
  1. +1
    -1
      frappe/cache_manager.py
  2. +2
    -2
      frappe/commands/site.py
  3. +1
    -1
      frappe/database/query.py

+ 1
- 1
frappe/cache_manager.py 查看文件

@@ -148,7 +148,7 @@ def build_table_count_cache():
data = ( data = (
frappe.qb.from_(information_schema.tables).select(table_name, table_rows) frappe.qb.from_(information_schema.tables).select(table_name, table_rows)
).run(as_dict=True) ).run(as_dict=True)
counts = {d.get('name').lstrip('tab'): d.get('count', None) for d in data}
counts = {d.get('name').replace('tab', '', 1): d.get('count', None) for d in data}
_cache.set_value("information_schema:counts", counts) _cache.set_value("information_schema:counts", counts)


return counts return counts


+ 2
- 2
frappe/commands/site.py 查看文件

@@ -952,7 +952,7 @@ def trim_database(context, dry_run, format, no_backup):
doctype_tables = frappe.get_all("DocType", pluck="name") doctype_tables = frappe.get_all("DocType", pluck="name")


for x in database_tables: for x in database_tables:
doctype = x.lstrip("tab")
doctype = x.replace("tab", "", 1)
if not (doctype in doctype_tables or x.startswith("__") or x in STANDARD_TABLES): if not (doctype in doctype_tables or x.startswith("__") or x in STANDARD_TABLES):
TABLES_TO_DROP.append(x) TABLES_TO_DROP.append(x)


@@ -966,7 +966,7 @@ def trim_database(context, dry_run, format, no_backup):


odb = scheduled_backup( odb = scheduled_backup(
ignore_conf=False, ignore_conf=False,
include_doctypes=",".join(x.lstrip("tab") for x in TABLES_TO_DROP),
include_doctypes=",".join(x.replace("tab", "", 1) for x in TABLES_TO_DROP),
ignore_files=True, ignore_files=True,
force=True, force=True,
) )


+ 1
- 1
frappe/database/query.py 查看文件

@@ -308,7 +308,7 @@ class Permission:
doctype = [doctype] doctype = [doctype]


for dt in doctype: for dt in doctype:
dt = re.sub("tab", "", dt)
dt = re.sub("^tab", "", dt)
if not frappe.has_permission( if not frappe.has_permission(
dt, dt,
"select", "select",


正在加载...
取消
保存