allembic for upgrade datas for actual hid's computers

This commit is contained in:
Cayo Puigdefabregas 2020-12-15 20:52:41 +01:00
parent de2539091c
commit 48d866b2d5
1 changed files with 2 additions and 2 deletions

View File

@ -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};"