fix: missing migration hash column

This commit is contained in:
abhishek 2021-09-20 14:52:42 +05:30
parent b2b391e90a
commit 278883edb0
5 changed files with 9 additions and 9 deletions

View file

@ -226,6 +226,7 @@ CREATE TABLE `tabDocType` (
`email_append_to` int(1) NOT NULL DEFAULT 0,
`subject_field` varchar(255) DEFAULT NULL,
`sender_field` varchar(255) DEFAULT NULL,
`migration_hash` varchar(255) DEFAULT NULL,
PRIMARY KEY (`name`),
KEY `parent` (`parent`)
) ENGINE=InnoDB ROW_FORMAT=DYNAMIC CHARACTER SET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

View file

@ -231,6 +231,7 @@ CREATE TABLE "tabDocType" (
"email_append_to" smallint NOT NULL DEFAULT 0,
"subject_field" varchar(255) DEFAULT NULL,
"sender_field" varchar(255) DEFAULT NULL,
"migration_hash" varchar(255) DEFAULT NULL,
PRIMARY KEY ("name")
) ;

View file

@ -18,6 +18,7 @@ from frappe.core.doctype.language.language import sync_languages
from frappe.modules.utils import sync_customizations
from frappe.core.doctype.scheduled_job_type.scheduled_job_type import sync_jobs
from frappe.search.website_search import build_index_for_all_routes
from frappe.database.schema import add_column
def migrate(verbose=True, skip_failing=False, skip_search_index=False):
@ -51,7 +52,7 @@ Otherwise, check the server logs and ensure that all the required services are r
os.remove(touched_tables_file)
try:
frappe.reload_doctype("DocType", force=True)
add_column(doctype="DocType", column_name="migration_hash", fieldtype="Data")
frappe.flags.touched_tables = set()
frappe.flags.in_migrate = True

View file

@ -76,19 +76,16 @@ def sync_for(app_name, force=0, sync_everything = False, verbose=False, reset_pe
# print each progress bar on new line
print()
def get_doc_files(files, start_path):
def get_doc_files(files, start_path, force=0, sync_everything = False, verbose=False):
"""walk and sync all doctypes and pages"""
files = files or []
# load in sequence - warning for devs
document_types = ['doctype', 'page', 'report', 'dashboard_chart_source', 'print_format',
'web_page', 'website_theme', 'web_form', 'web_template',
'notification', 'print_style',
'data_migration_mapping', 'data_migration_plan',
'workspace', 'onboarding_step', 'module_onboarding', 'form_tour',
'client_script', 'server_script', 'custom_field', 'property_setter']
'website_theme', 'web_form', 'web_template', 'notification', 'print_style',
'data_migration_mapping', 'data_migration_plan', 'workspace',
'onboarding_step', 'module_onboarding']
for doctype in document_types:
doctype_path = os.path.join(start_path, doctype)
if os.path.exists(doctype_path):

View file

@ -73,7 +73,7 @@ def import_file_by_path(path, force=False, data_import=False, pre_process=None,
if not force:
try:
db_hash = frappe.db.get_value(doc["doctype"], doc["name"], "migration_hash")
except:
except Exception:
frappe.flags.dt += [doc["doctype"]]
db_hash = None