Bench upgrade error: _mysql_exceptions.OperationalError: (1048, "Column 'in_dialog' cannot be null")

Hi,

Getting below error while upgrading from v 7.2 to 8. Can I get some help to solve it?

Executing frappe.patches.v8_0.update_global_search_table in site1.local (1bd3e0294d)
Success
Executing frappe.patches.v7_2.remove_in_filter in site1.local (1bd3e0294d)
Success
Executing execute:frappe.reload_doc('core', 'doctype', 'doctype', force=True) #2017-03-09 in site1.local (1bd3e0294d)
Success
Executing execute:frappe.reload_doc('core', 'doctype', 'docfield', force=True) #2017-03-03 in site1.local (1bd3e0294d)
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/ubuntu/frappe-bench/apps/frappe/frappe/utils/bench_helper.py", line 79, in <module>
    main()
  File "/home/ubuntu/frappe-bench/apps/frappe/frappe/utils/bench_helper.py", line 16, in main
    click.Group(commands=commands)(prog_name='bench')
  File "/home/ubuntu/frappe-bench/env/local/lib/python2.7/site-packages/click/core.py", line 716, in __call__
    return self.main(*args, **kwargs)
  File "/home/ubuntu/frappe-bench/env/local/lib/python2.7/site-packages/click/core.py", line 696, in main
    rv = self.invoke(ctx)
  File "/home/ubuntu/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/ubuntu/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/ubuntu/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/ubuntu/frappe-bench/env/local/lib/python2.7/site-packages/click/core.py", line 534, in invoke
    return callback(*args, **kwargs)
  File "/home/ubuntu/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/ubuntu/frappe-bench/apps/frappe/frappe/commands/__init__.py", line 24, in _func
    ret = f(frappe._dict(ctx.obj), *args, **kwargs)
  File "/home/ubuntu/frappe-bench/apps/frappe/frappe/commands/site.py", line 210, in migrate
    migrate(context.verbose, rebuild_website=rebuild_website)
  File "/home/ubuntu/frappe-bench/apps/frappe/frappe/migrate.py", line 31, in migrate
    frappe.modules.patch_handler.run_all()
  File "/home/ubuntu/frappe-bench/apps/frappe/frappe/modules/patch_handler.py", line 29, in run_all
    if not run_single(patchmodule = patch):
  File "/home/ubuntu/frappe-bench/apps/frappe/frappe/modules/patch_handler.py", line 63, in run_single
    return execute_patch(patchmodule, method, methodargs)
  File "/home/ubuntu/frappe-bench/apps/frappe/frappe/modules/patch_handler.py", line 81, in execute_patch
    exec patchmodule.split("execute:")[1] in globals()
  File "<string>", line 1, in <module>
  File "/home/ubuntu/frappe-bench/apps/frappe/frappe/__init__.py", line 663, in reload_doc
    return frappe.modules.reload_doc(module, dt, dn, force=force, reset_permissions=reset_permissions)
  File "/home/ubuntu/frappe-bench/apps/frappe/frappe/modules/utils.py", line 152, in reload_doc
    return import_files(module, dt, dn, force=force, reset_permissions=reset_permissions)
  File "/home/ubuntu/frappe-bench/apps/frappe/frappe/modules/import_file.py", line 19, in import_files
    reset_permissions=reset_permissions)
  File "/home/ubuntu/frappe-bench/apps/frappe/frappe/modules/import_file.py", line 24, in import_file
    ret = import_file_by_path(path, force, pre_process=pre_process, reset_permissions=reset_permissions)
  File "/home/ubuntu/frappe-bench/apps/frappe/frappe/modules/import_file.py", line 58, in import_file_by_path
    ignore_version=ignore_version, reset_permissions=reset_permissions)
  File "/home/ubuntu/frappe-bench/apps/frappe/frappe/modules/import_file.py", line 129, in import_doc
    doc.insert()
  File "/home/ubuntu/frappe-bench/apps/frappe/frappe/model/document.py", line 205, in insert
    self.db_insert()
  File "/home/ubuntu/frappe-bench/apps/frappe/frappe/model/base_document.py", line 296, in db_insert
    ), d.values())
  File "/home/ubuntu/frappe-bench/apps/frappe/frappe/database.py", line 138, in sql
    self._cursor.execute(query, values)
  File "/home/ubuntu/frappe-bench/env/local/lib/python2.7/site-packages/MySQLdb/cursors.py", line 205, in execute
    self.errorhandler(self, exc, value)
  File "/home/ubuntu/frappe-bench/env/local/lib/python2.7/site-packages/MySQLdb/connections.py", line 36, in defaulterrorhandler
    raise errorclass, errorvalue
_mysql_exceptions.OperationalError: (1048, "Column 'in_dialog' cannot be null")

Hi I am also getting the same error. Have you found the solution yet?

No, checked on other instance as well, upgrade is giving error after latest release.

Till last release (Release v8.0.14) I was able to upgrade same instance which failed with Release v8.0.15.

I am getting the same error… Any fixes yet??

Hi,

You can try this:

cd ~/frappe-bench
bench --site sitename mysql
ALTER TABLE tabDocType MODIFY COLUMN in_dialog int(1) NULL;

Then run bench update.

After that you can change the previous mysql command as before:

ALTER TABLE tabDocType MODIFY COLUMN in_dialog int(1) NOT NULL DEFAULT 1;

1 Like

Thanks @Krishna_Das

Update worked perfectly after modifying column, but after update re-modifying column gave error as below.

ERROR 1054 (42S22): Unknown column ‘in_dialog’ in ‘tabDocType’

Same problem. The ALTER TABLE solution above did not seem to solve the problem. Any advice is greatly appreciated!

I have the same. I added the column in_dialog manually, but this is not resolving the isssue.
I’m migrating (or try) from 8.013 to 9

I’m almost through with a fix for this. Follow the progress here:
https://github.com/frappe/frappe/issues/4311

I finally was able to migrate to V9.
This is what I did:

Install ERPnext
I installed a complete new instance of erpnext

  1. Download the install script
    wget https://raw.githubusercontent.com/frappe/bench/master/playbooks/install.py
  2. Run the install script
    sudo python install.py --production --user frappe

Restore
Copy content of site1.local (or your site directory) to the corresponding directory in the new created instance of frappe-bench.

Copy your last backup of your database to /frappe/frappe-bench/
Something like 20170421_091326_2a418746_database.sql

Open terminal
Type “sudo su”
Go to the frappe-bench folder
“cd /home/frappe/frappe-bench“
Run the following bench commands (to restore db and run latest)
If needed install extensions:
install base_vat
bench get-app base_vat GitHub - saguas/frappe_base_vat: Repository for frappe base vat application
bench install-app base_vat

install poll
bench get-app poll GitHub - frappe/poll: Online Polling App
bench install-app poll

restore ERPnext database
bench --force restore sqlfile.sql (sqlfile.sql = name of the recent backupfile)

bench mysql
ALTER TABLE tabDocType ADD COLUMN restrict_to_domain VARCHAR(40);
bench --force reload-doc core doctype page

You will need to copy the encryption keys from your old server. (they will be there in bench/sites/sitename/site_config.json)

bench build
bench migrate
bench restart

Hello,
I did all the steps you mentioned, it worked, but when i login i get a blank page with ERPNext logo in the center, can you help me please?

What version did you upgrade from?