瀏覽代碼

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 = (
frappe.qb.from_(information_schema.tables).select(table_name, table_rows)
).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)

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")

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):
TABLES_TO_DROP.append(x)

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

odb = scheduled_backup(
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,
force=True,
)


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

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

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


Loading…
取消
儲存