Bench Update/Migrate error - tabtimesheet

Hi,

While running bench update or bench migrate, I am facing this issue.

_mysql_exceptions.ProgrammingError: (1146, “Table ‘76cf18db07.tabtimesheet’ doesn’t exist”)

How to resolve it?

Thanks
Uma

Hi @UmaG,

Can you share complete traceback of an error.

Thanks, Rohit

Hi Rohit,

Attached is the traceback.

frappe-bench$ bench migrate
Migrating erpnext
Executing erpnext.patches.v7_0.convert_timelog_to_timesheet in erpnext (76cf18db07)
Traceback (most recent call last):
File “/usr/lib/python2.7/runpy.py”, line 162, in _run_module_as_main
main”, fname, loader, pkg_name)
File “/usr/lib/python2.7/runpy.py”, line 72, in _run_code
exec code in run_globals
File “/home/umag/frappe-bench/apps/frappe/frappe/utils/bench_helper.py”, line 79, in
main()
File “/home/umag/frappe-bench/apps/frappe/frappe/utils/bench_helper.py”, line 16, in main
click.Group(commands=commands)(prog_name=‘bench’)
File “/home/umag/frappe-bench/env/local/lib/python2.7/site-packages/click/core.py”, line 716, in call
return self.main(*args, **kwargs)
File “/home/umag/frappe-bench/env/local/lib/python2.7/site-packages/click/core.py”, line 696, in main
rv = self.invoke(ctx)
File “/home/umag/frappe-bench/env/local/lib/python2.7/site-packages/click/core.py”, line 1060, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File “/home/umag/frappe-bench/env/local/lib/python2.7/site-packages/click/core.py”, line 1060, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File “/home/umag/frappe-bench/env/local/lib/python2.7/site-packages/click/core.py”, line 889, in invoke
return ctx.invoke(self.callback, **ctx.params)
File “/home/umag/frappe-bench/env/local/lib/python2.7/site-packages/click/core.py”, line 534, in invoke
return callback(*args, **kwargs)
File “/home/umag/frappe-bench/env/local/lib/python2.7/site-packages/click/decorators.py”, line 17, in new_func
return f(get_current_context(), *args, **kwargs)
File “/home/umag/frappe-bench/apps/frappe/frappe/commands/init.py”, line 24, in _func
ret = f(frappe._dict(ctx.obj), *args, **kwargs)
File “/home/umag/frappe-bench/apps/frappe/frappe/commands/site.py”, line 182, in migrate
migrate(context.verbose, rebuild_website=rebuild_website)
File “/home/umag/frappe-bench/apps/frappe/frappe/migrate.py”, line 27, in migrate
frappe.modules.patch_handler.run_all()
File “/home/umag/frappe-bench/apps/frappe/frappe/modules/patch_handler.py”, line 25, in run_all
if not run_single(patchmodule = patch):
File “/home/umag/frappe-bench/apps/frappe/frappe/modules/patch_handler.py”, line 52, in run_single
return execute_patch(patchmodule, method, methodargs)
File “/home/umag/frappe-bench/apps/frappe/frappe/modules/patch_handler.py”, line 68, in execute_patch
frappe.get_attr(patchmodule.split()[0] + “.execute”)()
File “/home/umag/frappe-bench/apps/erpnext/erpnext/patches/v7_0/convert_timelog_to_timesheet.py”, line 6, in execute
if “note” not in frappe.db.get_table_columns(“timesheet”):
File “/home/umag/frappe-bench/apps/frappe/frappe/database.py”, line 766, in get_table_columns
return [r[0] for r in self.sql(“DESC tab%s” % doctype)]
File “/home/umag/frappe-bench/apps/frappe/frappe/database.py”, line 148, in sql
self._cursor.execute(query)
File “/home/umag/frappe-bench/env/local/lib/python2.7/site-packages/MySQLdb/cursors.py”, line 205, in execute
self.errorhandler(self, exc, value)
File “/home/umag/frappe-bench/env/local/lib/python2.7/site-packages/MySQLdb/connections.py”, line 36, in defaulterrorhandler
raise errorclass, errorvalue
_mysql_exceptions.ProgrammingError: (1146, “Table ‘76cf18db07.tabtimesheet’ doesn’t exist”)

Hi @UmaG,

Have fixed the issue, please take latest update and check it.

Thanks, Rohit

Thanks @rohit_w… I am not getting that error any longer. But, I am getting another error. Not sure if it is related to that or something else.

Traceback (most recent call last):
File “/usr/lib/python2.7/runpy.py”, line 162, in _run_module_as_main
main”, fname, loader, pkg_name)
File “/usr/lib/python2.7/runpy.py”, line 72, in _run_code
exec code in run_globals
File “/home/umag/frappe-bench/apps/frappe/frappe/utils/bench_helper.py”, line 79, in
main()
File “/home/umag/frappe-bench/apps/frappe/frappe/utils/bench_helper.py”, line 16, in main
click.Group(commands=commands)(prog_name=‘bench’)
File “/home/umag/frappe-bench/env/local/lib/python2.7/site-packages/click/core.py”, line 716, in call
return self.main(*args, **kwargs)
File “/home/umag/frappe-bench/env/local/lib/python2.7/site-packages/click/core.py”, line 696, in main
rv = self.invoke(ctx)
File “/home/umag/frappe-bench/env/local/lib/python2.7/site-packages/click/core.py”, line 1060, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File “/home/umag/frappe-bench/env/local/lib/python2.7/site-packages/click/core.py”, line 1060, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File “/home/umag/frappe-bench/env/local/lib/python2.7/site-packages/click/core.py”, line 889, in invoke
return ctx.invoke(self.callback, **ctx.params)
File “/home/umag/frappe-bench/env/local/lib/python2.7/site-packages/click/core.py”, line 534, in invoke
return callback(*args, **kwargs)
File “/home/umag/frappe-bench/env/local/lib/python2.7/site-packages/click/decorators.py”, line 17, in new_func
return f(get_current_context(), *args, **kwargs)
File “/home/umag/frappe-bench/apps/frappe/frappe/commands/init.py”, line 24, in _func
ret = f(frappe._dict(ctx.obj), *args, **kwargs)
File “/home/umag/frappe-bench/apps/frappe/frappe/commands/site.py”, line 182, in migrate
migrate(context.verbose, rebuild_website=rebuild_website)
File “/home/umag/frappe-bench/apps/frappe/frappe/migrate.py”, line 29, in migrate
frappe.model.sync.sync_all(verbose=verbose)
File “/home/umag/frappe-bench/apps/frappe/frappe/model/sync.py”, line 19, in sync_all
sync_for(app, force, verbose=verbose)
File “/home/umag/frappe-bench/apps/frappe/frappe/model/sync.py”, line 37, in sync_for
folder = os.path.dirname(frappe.get_module(app_name + “.” + module_name).file)
File “/home/umag/frappe-bench/apps/frappe/frappe/init.py”, line 643, in get_module
return importlib.import_module(modulename)
File “/usr/lib/python2.7/importlib/init.py”, line 37, in import_module
import(name)
ImportError: No module named <<<<<<<_head
Traceback (most recent call last):
File “/usr/local/bin/bench”, line 9, in
load_entry_point(‘bench==3.0.0’, ‘console_scripts’, ‘bench’)()
File “/home/umag/bench-repo/bench/cli.py”, line 40, in cli
bench_command()
File “/usr/local/lib/python2.7/dist-packages/click/core.py”, line 716, in call
return self.main(*args, **kwargs)
File “/usr/local/lib/python2.7/dist-packages/click/core.py”, line 696, in main
rv = self.invoke(ctx)
File “/usr/local/lib/python2.7/dist-packages/click/core.py”, line 1060, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File “/usr/local/lib/python2.7/dist-packages/click/core.py”, line 889, in invoke
return ctx.invoke(self.callback, **ctx.params)
File “/usr/local/lib/python2.7/dist-packages/click/core.py”, line 534, in invoke
return callback(*args, **kwargs)
File “/home/umag/bench-repo/bench/commands/update.py”, line 60, in update
_update(pull, patch, build, bench, auto, restart_supervisor, requirements, no_backup, upgrade, force=force)
File “/home/umag/bench-repo/bench/commands/update.py”, line 90, in _update
patch_sites(bench_path=bench_path)
File “/home/umag/bench-repo/bench/utils.py”, line 122, in patch_sites
run_frappe_cmd(‘–site’, ‘all’, ‘migrate’, bench_path=bench_path)
File “/home/umag/bench-repo/bench/utils.py”, line 451, in run_frappe_cmd
raise CommandFailedError(args)
bench.utils.CommandFailedError: (‘–site’, ‘all’, ‘migrate’)

Hi @UmaG,

Seems like conflicts in local machine.
Do you have any custom changes in ERPNext?

Thanks, Rohit

@rohit_w
when I run bench update it showing like above,so I delete that
<<<_head
like lines and re-run and it works,is the correct way?

Yes, I have a few custom changes done in my ERPNext. But, this error is not reflecting which file could be having conflict.

Hi @UmaG,

Run below commands,
git status
git diff
In individual app(erpnext, frappe), so you will get the uncommented files

Thanks, Rohit

Hi @hereabdulla,

Yes, that’s the correct way.

Thanks, Rohit

Hi @UmaG,

Remove the conflicts, commit your changes and run bench migrate command.

Thanks, Rohit

Yes. It worked fine. Sorry, forgot to reply back earlier on this. You can close this issue.