Browse Source

Par drobnych zmen

middleware_test
Pavel Turinsky (DebianVM @ Zr) 3 years ago
parent
commit
df14d03fc2
  1. 8
      db_compare.py

8
db_compare.py

@ -78,7 +78,7 @@ def check_resitel():
'prijmeni', 'prijmeni',
'user_id', 'user_id',
'pohlavi_muz', 'pohlavi_muz',
#'email', #TODO: potřeba dořešit, protože merge řešitele a organizátora #'email', #vyreseno separatne
'telefon', 'telefon',
'datum_narozeni', 'datum_narozeni',
'datum_souhlasu_udaje', 'datum_souhlasu_udaje',
@ -99,6 +99,8 @@ def check_resitel():
fields = fields_keep+fields_osoba fields = fields_keep+fields_osoba
for o,n in res: for o,n in res:
check_same(o,n,fields) check_same(o,n,fields)
if o['email'] != n['email'] and o['email'] != '':
print(f"WARNING: Emails differ: old: {o['email']}, new: {n['email']}")
def check_reseni(): def check_reseni():
# Migrace 0058 zamerne meni (zmensuje) pocet reseni, aby kazdy clanek mel # Migrace 0058 zamerne meni (zmensuje) pocet reseni, aby kazdy clanek mel
@ -183,7 +185,7 @@ def check_organizator():
# Migrace prirazuje aktualni casovou zonu, takze chceme tady rucne vynutit CET. # Migrace prirazuje aktualni casovou zonu, takze chceme tady rucne vynutit CET.
from datetime import timedelta, timezone from datetime import timedelta, timezone
cet = timezone(timedelta(hours=1)) cet = timezone(timedelta(hours=1))
if o['organizuje_do_roku'] is None and n['organizuje_do'] is None: if o['organizuje_od_roku'] is None and n['organizuje_od'] is None:
pass pass
elif o['organizuje_od_roku'] != n['organizuje_od'].astimezone(cet).year: elif o['organizuje_od_roku'] != n['organizuje_od'].astimezone(cet).year:
raise ValueError(f'Not matching organizuje_od for org id={o["id"]}: old {o["organizuje_od_roku"]}, new {n["organizuje_od"]}') raise ValueError(f'Not matching organizuje_od for org id={o["id"]}: old {o["organizuje_od_roku"]}, new {n["organizuje_od"]}')
@ -430,7 +432,7 @@ def check_tema():
def check_konfera(): def check_konfera():
old_query = "SELECT * FROM seminar_problemy WHERE typ = 'konfera'" old_query = "SELECT * FROM seminar_problemy WHERE typ = 'konfera'"
new_query = "SELECT * FROM seminar_konfera AS k JOIN seminar_problemy AS problem ON k.problem_ptr_id = problem.id" new_query = "SELECT * FROM seminar_konfera"
oldcur.execute(old_query) oldcur.execute(old_query)
newcur.execute(new_query) newcur.execute(new_query)

Loading…
Cancel
Save