[solved] Upgrading v11 -> v12 stuck at pymysql.err.IntegrityError: (1062, "Duplicate entry

I am pulling my hair out over an upgrade proces v11 → v12.

These are my planned steps

  1. cd ~/frappe-bench
  2. bench update
  3. bench setup requirements
  4. git config remote.upstream.fetch +refs/heads/:refs/remotes/upstream/
  5. bench switch-to-branch version-12 frappe erpnext --upgrade
  6. sudo systemctl restart redis
  7. redis-cli -p 13000 FLUSHALL
  8. bench update --patch
  9. bench migrate
  10. bench update --build

I get stuck during #8 bench update --patch

with an error on erpnext.patches.v12_0.update_uom_conversion_factor

the complaint "Duplicate entry 'MAT-UOM-CNV-00001' for key 'PRIMARY'" which it seems to come down to does not make sense to me. I have examined the db and can not find anything justifying that error.

can anybody help with this?

I’m assuming in SQL table ‘tabUOM Conversion Factor’, there exists already a row with name = ‘MAT-UOM-CNV-00001

Check your Naming Series. What is the next number for Series MAT-UOM-CNV?

If the next value is 1, this would explain the problem. The patch might be trying to insert a new UOM conversion. And because of the Naming Series, it believes that MAT-UOM-CNV-00001 is an available value for ‘name

1 Like

yes, of course. It’s the UOM conversion Meter/Meter. But as it exists only once I could not make any sense from ist

spot on. Namin Series was set to Current Value = 0, set this to the actual latest value (231) and could proceed with the upgrade process.

I really was pulling my hair on this, so you made the last couple of weeks for me. thanks a mil

can you please elaborate how can change the current value to latest?


Hi, @markgates , How to get current value.

count(`name`) from `tabUOM Conversion Factor`

hope this will help !!!

1 Like