From 48d866b2d52c8aa22d3b80ff8193d71d9a7da4e1 Mon Sep 17 00:00:00 2001 From: Cayo Puigdefabregas Date: Tue, 15 Dec 2020 20:52:41 +0100 Subject: [PATCH] allembic for upgrade datas for actual hid's computers --- .../migrations/versions/bf600ca861a4_adding_hid.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ereuse_devicehub/migrations/versions/bf600ca861a4_adding_hid.py b/ereuse_devicehub/migrations/versions/bf600ca861a4_adding_hid.py index 662671c6..ae68e3ed 100644 --- a/ereuse_devicehub/migrations/versions/bf600ca861a4_adding_hid.py +++ b/ereuse_devicehub/migrations/versions/bf600ca861a4_adding_hid.py @@ -40,6 +40,8 @@ def upgrade(): macs = {} for c in computers: hids[c.id] = c.hid + if not c.serial_number: + continue try: macs[c.id].append(c.serial_number) macs[c.id].sort() @@ -52,8 +54,6 @@ def upgrade(): if not id_dev in macs: continue mac = macs[id_dev][0] - if not mac: - continue new_hid = "{}-{}".format(hid, mac) sql = f"update {get_inv()}.device set hid='{new_hid}' where id={id_dev};"