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',
'user_id',
'pohlavi_muz',
#'email', #TODO: potřeba dořešit, protože merge řešitele a organizátora
#'email', #vyreseno separatne
'telefon',
'datum_narozeni',
'datum_souhlasu_udaje',
@ -99,6 +99,8 @@ def check_resitel():
fields = fields_keep+fields_osoba
for o,n in res:
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():
# 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.
from datetime import timedelta, timezone
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
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"]}')
@ -430,7 +432,7 @@ def check_tema():
def check_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)
newcur.execute(new_query)

Loading…
Cancel
Save