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 = {} macs = {}
for c in computers: for c in computers:
hids[c.id] = c.hid hids[c.id] = c.hid
if not c.serial_number:
continue
try: try:
macs[c.id].append(c.serial_number) macs[c.id].append(c.serial_number)
macs[c.id].sort() macs[c.id].sort()
@ -52,8 +54,6 @@ def upgrade():
if not id_dev in macs: if not id_dev in macs:
continue continue
mac = macs[id_dev][0] mac = macs[id_dev][0]
if not mac:
continue
new_hid = "{}-{}".format(hid, mac) new_hid = "{}-{}".format(hid, mac)
sql = f"update {get_inv()}.device set hid='{new_hid}' where id={id_dev};" sql = f"update {get_inv()}.device set hid='{new_hid}' where id={id_dev};"