Bench migration fails (truncated data)

I run bench --site suntek.dev migrate --skip-failing and it throws the following error

Migrating suntek.dev
Updating DocTypes for frappe        : [========================================] 100%
Updating DocTypes for payments      : [========================================] 100%
Updating DocTypes for erpnext       : [========================================] 100%
Updating DocTypes for hrms          : [========================================] 100%
Updating DocTypes for india_compliance: [========================================] 100%
Updating DocTypes for frappe_whatsapp: [========================================] 100%
Updating DocTypes for suntek_app    : [========================================] 100%
Updating DocTypes for employee_self_service: [========================================] 100%
Failed to alter schema using query: ALTER TABLE `tabOpportunity` MODIFY `conversion_rate` decimal(21,9) not null default 0, MODIFY `base_total` decimal(21,9) not null default 0, MODIFY `base_opportunity_amount` decimal(21,9) not null default 0, MODIFY `opportunity_amount` decimal(21,9) not null default 0, MODIFY `custom_capacity` decimal(21,9) not null default 0, MODIFY `total` decimal(21,9) not null default 0, MODIFY `annual_revenue` decimal(21,9) not null default 0, MODIFY `first_response_time` decimal(21,9)
Queued rebuilding of search index for suntek.dev

Traceback (most recent call last):
  File "<frozen runpy>", line 198, in _run_module_as_main
  File "<frozen runpy>", line 88, in _run_code
  File "/Users/navtech/dev/suntek_erp_app/frappe-bench/apps/frappe/frappe/utils/bench_helper.py", line 114, in <module>
    main()
  File "/Users/navtech/dev/suntek_erp_app/frappe-bench/apps/frappe/frappe/utils/bench_helper.py", line 20, in main
    click.Group(commands=commands)(prog_name="bench")
  File "/Users/navtech/dev/suntek_erp_app/frappe-bench/env/lib/python3.12/site-packages/click/core.py", line 1161, in __call__
    return self.main(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/navtech/dev/suntek_erp_app/frappe-bench/env/lib/python3.12/site-packages/click/core.py", line 1082, in main
    rv = self.invoke(ctx)
         ^^^^^^^^^^^^^^^^
  File "/Users/navtech/dev/suntek_erp_app/frappe-bench/env/lib/python3.12/site-packages/click/core.py", line 1697, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
                           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/navtech/dev/suntek_erp_app/frappe-bench/env/lib/python3.12/site-packages/click/core.py", line 1697, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
                           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/navtech/dev/suntek_erp_app/frappe-bench/env/lib/python3.12/site-packages/click/core.py", line 1443, in invoke
    return ctx.invoke(self.callback, **ctx.params)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/navtech/dev/suntek_erp_app/frappe-bench/env/lib/python3.12/site-packages/click/core.py", line 788, in invoke
    return __callback(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/navtech/dev/suntek_erp_app/frappe-bench/env/lib/python3.12/site-packages/click/decorators.py", line 33, in new_func
    return f(get_current_context(), *args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/navtech/dev/suntek_erp_app/frappe-bench/apps/frappe/frappe/commands/__init__.py", line 29, in _func
    ret = f(frappe._dict(ctx.obj), *args, **kwargs)
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/navtech/dev/suntek_erp_app/frappe-bench/apps/frappe/frappe/commands/site.py", line 689, in migrate
    ).run(site=site)
      ^^^^^^^^^^^^^^
  File "/Users/navtech/dev/suntek_erp_app/frappe-bench/apps/frappe/frappe/migrate.py", line 187, in run
    self.post_schema_updates()
  File "/Users/navtech/dev/suntek_erp_app/frappe-bench/apps/frappe/frappe/migrate.py", line 52, in wrapper
    raise e
  File "/Users/navtech/dev/suntek_erp_app/frappe-bench/apps/frappe/frappe/migrate.py", line 44, in wrapper
    ret = method(*args, **kwargs)
          ^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/navtech/dev/suntek_erp_app/frappe-bench/apps/frappe/frappe/migrate.py", line 140, in post_schema_updates
    sync_fixtures()
  File "/Users/navtech/dev/suntek_erp_app/frappe-bench/apps/frappe/frappe/utils/fixtures.py", line 22, in sync_fixtures
    import_fixtures(app)
  File "/Users/navtech/dev/suntek_erp_app/frappe-bench/apps/frappe/frappe/utils/fixtures.py", line 41, in import_fixtures
    import_doc(file_path)
  File "/Users/navtech/dev/suntek_erp_app/frappe-bench/apps/frappe/frappe/core/doctype/data_import/data_import.py", line 265, in import_doc
    import_file_by_path(
  File "/Users/navtech/dev/suntek_erp_app/frappe-bench/apps/frappe/frappe/modules/import_file.py", line 146, in import_file_by_path
    import_doc(
  File "/Users/navtech/dev/suntek_erp_app/frappe-bench/apps/frappe/frappe/modules/import_file.py", line 239, in import_doc
    doc.insert()
  File "/Users/navtech/dev/suntek_erp_app/frappe-bench/apps/frappe/frappe/model/document.py", line 320, in insert
    self.run_post_save_methods()
  File "/Users/navtech/dev/suntek_erp_app/frappe-bench/apps/frappe/frappe/model/document.py", line 1140, in run_post_save_methods
    self.run_method("on_update")
  File "/Users/navtech/dev/suntek_erp_app/frappe-bench/apps/frappe/frappe/model/document.py", line 974, in run_method
    out = Document.hook(fn)(self, *args, **kwargs)
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/navtech/dev/suntek_erp_app/frappe-bench/apps/frappe/frappe/model/document.py", line 1334, in composer
    return composed(self, method, *args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/navtech/dev/suntek_erp_app/frappe-bench/apps/frappe/frappe/model/document.py", line 1316, in runner
    add_to_return_value(self, fn(self, *args, **kwargs))
                              ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/navtech/dev/suntek_erp_app/frappe-bench/apps/frappe/frappe/model/document.py", line 971, in fn
    return method_object(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/navtech/dev/suntek_erp_app/frappe-bench/apps/frappe/frappe/custom/doctype/custom_field/custom_field.py", line 213, in on_update
    frappe.db.updatedb(self.dt)
  File "/Users/navtech/dev/suntek_erp_app/frappe-bench/apps/frappe/frappe/database/mariadb/database.py", line 448, in updatedb
    db_table.sync()
  File "/Users/navtech/dev/suntek_erp_app/frappe-bench/apps/frappe/frappe/database/schema.py", line 44, in sync
    self.alter()
  File "/Users/navtech/dev/suntek_erp_app/frappe-bench/apps/frappe/frappe/database/mariadb/schema.py", line 111, in alter
    frappe.db.sql_ddl(query)
  File "/Users/navtech/dev/suntek_erp_app/frappe-bench/apps/frappe/frappe/database/database.py", line 413, in sql_ddl
    self.sql(query, debug=debug)
  File "/Users/navtech/dev/suntek_erp_app/frappe-bench/apps/frappe/frappe/database/database.py", line 230, in sql
    self._cursor.execute(query, values)
  File "/Users/navtech/dev/suntek_erp_app/frappe-bench/env/lib/python3.12/site-packages/pymysql/cursors.py", line 153, in execute
    result = self._query(query)
             ^^^^^^^^^^^^^^^^^^
  File "/Users/navtech/dev/suntek_erp_app/frappe-bench/env/lib/python3.12/site-packages/pymysql/cursors.py", line 322, in _query
    conn.query(q)
  File "/Users/navtech/dev/suntek_erp_app/frappe-bench/env/lib/python3.12/site-packages/pymysql/connections.py", line 563, in query
    self._affected_rows = self._read_query_result(unbuffered=unbuffered)
                          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/navtech/dev/suntek_erp_app/frappe-bench/env/lib/python3.12/site-packages/pymysql/connections.py", line 825, in _read_query_result
    result.read()
  File "/Users/navtech/dev/suntek_erp_app/frappe-bench/env/lib/python3.12/site-packages/pymysql/connections.py", line 1199, in read
    first_packet = self.connection._read_packet()
                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/navtech/dev/suntek_erp_app/frappe-bench/env/lib/python3.12/site-packages/pymysql/connections.py", line 775, in _read_packet
    packet.raise_for_error()
  File "/Users/navtech/dev/suntek_erp_app/frappe-bench/env/lib/python3.12/site-packages/pymysql/protocol.py", line 219, in raise_for_error
    err.raise_mysql_exception(self._data)
  File "/Users/navtech/dev/suntek_erp_app/frappe-bench/env/lib/python3.12/site-packages/pymysql/err.py", line 150, in raise_mysql_exception
    raise errorclass(errno, errval)
pymysql.err.DataError: (1265, "Data truncated for column 'custom_capacity' at row 1")

How can I debug this?

try this bench reload-doctype Opportunity

1 Like