raiseValueError(f"Fields '{old_field}' and '{new_field}' differs for rows \n'{old_row}' and \n'{new_row}'")
raiseValueError(f"Fields '{old_field}'({old_row[old_field]}) and '{new_field}'({new_row[new_field]}) differs for rows \n'{old_row}' and \n'{new_row}'")
returnTrue
returnTrue
defget_user_id_for_org_id(org_id):
defget_user_id_for_org_id(org_id):
@ -64,10 +64,10 @@ def check_skola():
defcheck_resitel():
defcheck_resitel():
old_query='SELECT * FROM seminar_resitele ORDER BY id'
old_query='SELECT * FROM seminar_resitele ORDER BY id'
#'email', #TODO: potřeba dořešit, protože merge řešitele a organizátora
'telefon',
'telefon',
'datum_narozeni',
'datum_narozeni',
'datum_souhlasu_udaje',
'datum_souhlasu_udaje',
@ -102,7 +102,10 @@ def check_resitel():
defcheck_reseni():
defcheck_reseni():
old_query='SELECT * FROM seminar_reseni ORDER BY id'
old_query='SELECT * FROM seminar_reseni ORDER BY id'
new_query='SELECT id, forma, poznamka, cas_doruceni, hodnoceni.problem_id AS h_problem_id, hodnoceni.body AS h_body, hodnoceni.cislo_body_id AS h_cislo_body_id FROM seminar_reseni JOIN seminar_hodnoceni AS hodnoceni ON hodnoceni_id = hodnoceni.id ORDER BY id'
new_query='''SELECT seminar_reseni.id, forma, poznamka, cas_doruceni, hodnoceni.problem_id AS h_problem_id, hodnoceni.body AS h_body, hodnoceni.cislo_body_id AS h_cislo_body_id
# Řešitelé jsou nově m2m, takže je musíme dohledat
# Řešitelé jsou nově m2m, takže je musíme dohledat
old_query='SELECT id, resitel_id FROM seminar_reseni ORDER BY id'
old_query='SELECT id, resitel_id FROM seminar_reseni ORDER BY id'
new_query='SELECT reseni_id, resitel_id FROM seminar_reseni_resitele ORDER BY reseni_id'
new_query='SELECT reseni_id, resitele_id FROM seminar_reseni_resitele ORDER BY reseni_id'
oldcur=oldconn.cursor()
#oldcur = oldconn.cursor()
old_results=oldcur.execute(old_query).fetchall()
oldcur.execute(old_query)
newcur=newconn.cursor()
old_results=oldcur.fetchall()
new_results=newcur.execute(new_query).fetchall()
#newcur = newconn.cursor()
newcur.execute(new_query)
new_results=newcur.fetchall()
foroldrinold_results:
foroldrinold_results:
ifoldrnotinnew_results:
ifoldrnotinnew_results:
raiseValueError(f'Reseni pair {oldr} not found in new db.')
raiseValueError(f'Reseni pair {oldr} not found in new db.')
defcheck_organizator():
defcheck_organizator():
old_query='SELECT * FROM seminar_organizatori ORDER BY id'
old_query='SELECT * FROM seminar_organizator ORDER BY id'
new_query='SELECT studuje, strucny_popis_organizatora, user.id AS uid, osoba.prezdivka AS o_prezdivka, osoba.foto AS o_foto, osoba.foto_male AS o_foto_male FROM seminar_organizatori JOIN seminar_osoby AS osoba ON osoba_id = osoba.id JOIN auth_user AS user ON osoba.user_id = user.id ORDER BY id'
new_query='''SELECT seminar_organizator.id AS id, studuje, strucny_popis_organizatora, users.id AS uid, osoba.prezdivka AS o_prezdivka, osoba.foto AS o_foto, organizuje_od, organizuje_do