Document repair migration
* disables all migration parts despite document migration * running again with now fixed document migration handling, broken documents will be replaced with fixed ones
This commit is contained in:
parent
4f5c172449
commit
44e21f4ed9
@ -16,6 +16,7 @@ class CompensationMigrater(BaseMigrater):
|
||||
def migrate(self):
|
||||
self.connect_db()
|
||||
cursor = self.db_connection.cursor()
|
||||
#el = "'KOM-1568808121948'" # Test purposes
|
||||
empty_str = "''"
|
||||
cursor.execute(
|
||||
'select '
|
||||
@ -57,32 +58,33 @@ class CompensationMigrater(BaseMigrater):
|
||||
identifier=kom_identifier
|
||||
)[0]
|
||||
|
||||
compensation.title = kom_title
|
||||
compensation.comment = kom_comment
|
||||
try:
|
||||
compensation = self._migrate_interventions_reference(compensation, kom)
|
||||
except ObjectDoesNotExist:
|
||||
compensation.delete()
|
||||
unsuccessfull_compensations[kom_identifier] = "EIV does not exist"
|
||||
continue
|
||||
#compensation.title = kom_title
|
||||
#compensation.comment = kom_comment
|
||||
### FOR INITIAL RECONSTRUCTION OF EIV-KOM RELATIONSHIP
|
||||
#try:
|
||||
# compensation = self._migrate_interventions_reference(compensation, kom)
|
||||
#except ObjectDoesNotExist:
|
||||
# compensation.delete()
|
||||
# unsuccessfull_compensations[kom_identifier] = "EIV does not exist"
|
||||
# continue
|
||||
|
||||
compensation = self._migrate_par_7_data(compensation, kom)
|
||||
compensation = self._migrate_responsibility(compensation, kom)
|
||||
compensation = self._migrate_compensation_type(compensation, kom)
|
||||
compensation = self._migrate_states(compensation, kom)
|
||||
compensation = self._migrate_deadlines(compensation, kom)
|
||||
compensation = self._migrate_action_control_deadlines(compensation, kom)
|
||||
compensation = self._migrate_actions(compensation, kom)
|
||||
compensation = self._migrate_log(compensation, kom)
|
||||
#compensation = self._migrate_par_7_data(compensation, kom)
|
||||
#compensation = self._migrate_responsibility(compensation, kom)
|
||||
#compensation = self._migrate_compensation_type(compensation, kom)
|
||||
#compensation = self._migrate_states(compensation, kom)
|
||||
#compensation = self._migrate_deadlines(compensation, kom)
|
||||
#compensation = self._migrate_action_control_deadlines(compensation, kom)
|
||||
#compensation = self._migrate_actions(compensation, kom)
|
||||
#compensation = self._migrate_log(compensation, kom)
|
||||
compensation = self._migrate_documents(compensation, CompensationDocument, kom)
|
||||
compensation.save()
|
||||
num_processed += 1
|
||||
|
||||
compensation = self._migrate_geometry(compensation, kom)
|
||||
compensation.save()
|
||||
print("The following KOMs could not be migrated: ")
|
||||
for kom, val in unsuccessfull_compensations.items():
|
||||
print(kom)
|
||||
#compensation = self._migrate_geometry(compensation, kom)
|
||||
#compensation.save()
|
||||
#print("The following KOMs could not be migrated: ")
|
||||
#for kom, val in unsuccessfull_compensations.items():
|
||||
# print(kom)
|
||||
cursor.close()
|
||||
|
||||
def _migrate_interventions_reference(self, compensation, kom):
|
||||
|
@ -21,7 +21,7 @@ from user.models import UserActionLogEntry
|
||||
class EcoAccountMigrater(CompensationMigrater):
|
||||
|
||||
def migrate(self):
|
||||
el = "'OEK-1488450234228'"
|
||||
#el = "'OEK-1611234357085'" # Test purposes
|
||||
self.connect_db()
|
||||
cursor = self.db_connection.cursor()
|
||||
cursor.execute(
|
||||
@ -61,25 +61,25 @@ class EcoAccountMigrater(CompensationMigrater):
|
||||
identifier=oek_identifier
|
||||
)[0]
|
||||
|
||||
eco_account.title = oek_title
|
||||
eco_account.prevent_recording = False
|
||||
eco_account.comment = oek_comment
|
||||
eco_account = self._migrate_legal(eco_account, oek)
|
||||
eco_account = self._migrate_states(eco_account, oek)
|
||||
eco_account = self._migrate_responsibility(eco_account, oek)
|
||||
eco_account = self._migrate_deadlines(eco_account, oek)
|
||||
eco_account = self._migrate_action_control_deadlines(eco_account, oek)
|
||||
eco_account = self._migrate_actions(eco_account, oek)
|
||||
eco_account = self._migrate_log(eco_account, oek)
|
||||
eco_account = self._migrate_recorded(eco_account, oek)
|
||||
eco_account = self._migrate_deductions(eco_account, oek)
|
||||
#eco_account.title = oek_title
|
||||
#eco_account.prevent_recording = False
|
||||
#eco_account.comment = oek_comment
|
||||
#eco_account = self._migrate_legal(eco_account, oek)
|
||||
#eco_account = self._migrate_states(eco_account, oek)
|
||||
#eco_account = self._migrate_responsibility(eco_account, oek)
|
||||
#eco_account = self._migrate_deadlines(eco_account, oek)
|
||||
#eco_account = self._migrate_action_control_deadlines(eco_account, oek)
|
||||
#eco_account = self._migrate_actions(eco_account, oek)
|
||||
#eco_account = self._migrate_log(eco_account, oek)
|
||||
#eco_account = self._migrate_recorded(eco_account, oek)
|
||||
#eco_account = self._migrate_deductions(eco_account, oek)
|
||||
eco_account = self._migrate_documents(eco_account, EcoAccountDocument, oek)
|
||||
eco_account.save()
|
||||
|
||||
num_processed += 1
|
||||
|
||||
eco_account = self._migrate_geometry(eco_account, oek)
|
||||
eco_account.save()
|
||||
#eco_account = self._migrate_geometry(eco_account, oek)
|
||||
#eco_account.save()
|
||||
cursor.close()
|
||||
|
||||
def _migrate_geometry(self, instance, db_result: tuple):
|
||||
|
@ -16,6 +16,7 @@ class EmaMigrater(CompensationMigrater):
|
||||
def migrate(self):
|
||||
self.connect_db()
|
||||
cursor = self.db_connection.cursor()
|
||||
#el = "'EMA-1469083068361'" # Test purposes
|
||||
cursor.execute(
|
||||
'select '
|
||||
'om."KENNUNG", '
|
||||
@ -54,24 +55,24 @@ class EmaMigrater(CompensationMigrater):
|
||||
identifier=ema_identifier
|
||||
)[0]
|
||||
|
||||
ema_obj.title = ema_title
|
||||
ema_obj.comment = ema_comment
|
||||
ema_obj = self._migrate_responsibility(ema_obj, ema)
|
||||
ema_obj = self._migrate_compensation_type(ema_obj, ema)
|
||||
ema_obj = self._migrate_states(ema_obj, ema)
|
||||
ema_obj = self._migrate_deadlines(ema_obj, ema)
|
||||
ema_obj = self._migrate_action_control_deadlines(ema_obj, ema)
|
||||
ema_obj = self._migrate_actions(ema_obj, ema)
|
||||
ema_obj = self._migrate_finance_volume_to_comment(ema_obj, ema)
|
||||
ema_obj = self._migrate_log(ema_obj, ema)
|
||||
#ema_obj.title = ema_title
|
||||
#ema_obj.comment = ema_comment
|
||||
#ema_obj = self._migrate_responsibility(ema_obj, ema)
|
||||
#ema_obj = self._migrate_compensation_type(ema_obj, ema)
|
||||
#ema_obj = self._migrate_states(ema_obj, ema)
|
||||
#ema_obj = self._migrate_deadlines(ema_obj, ema)
|
||||
#ema_obj = self._migrate_action_control_deadlines(ema_obj, ema)
|
||||
#ema_obj = self._migrate_actions(ema_obj, ema)
|
||||
#ema_obj = self._migrate_finance_volume_to_comment(ema_obj, ema)
|
||||
#ema_obj = self._migrate_log(ema_obj, ema)
|
||||
ema_obj = self._migrate_documents(ema_obj, EmaDocument, ema)
|
||||
ema_obj = self._migrate_recorded(ema_obj, ema)
|
||||
#ema_obj = self._migrate_recorded(ema_obj, ema)
|
||||
ema_obj.save()
|
||||
|
||||
num_processed += 1
|
||||
|
||||
ema_obj = self._migrate_geometry(ema_obj, ema)
|
||||
ema_obj.save()
|
||||
#ema_obj = self._migrate_geometry(ema_obj, ema)
|
||||
#ema_obj.save()
|
||||
|
||||
cursor.close()
|
||||
|
||||
|
@ -146,7 +146,7 @@ class InterventionMigrater(BaseMigrater):
|
||||
|
||||
def migrate(self):
|
||||
self.connect_db()
|
||||
el = "'EIV-1380625802430'"
|
||||
#el = "'EIV-1613988897199'" # Test purposes
|
||||
cursor = self.db_connection.cursor()
|
||||
cursor.execute(
|
||||
'select '
|
||||
@ -181,8 +181,7 @@ class InterventionMigrater(BaseMigrater):
|
||||
'where '
|
||||
'om."OKL"=7730085 and '
|
||||
'om.archiv=false and '
|
||||
'om.nicht_vollstaendig=0 and '
|
||||
f'om."KENNUNG"={el}'
|
||||
'om.nicht_vollstaendig=0'
|
||||
)
|
||||
|
||||
all_eivs = cursor.fetchall()
|
||||
@ -209,7 +208,7 @@ class InterventionMigrater(BaseMigrater):
|
||||
|
||||
#intervention = self._migrate_geometry(intervention, eiv)
|
||||
#intervention = self._migrate_intervention_payment(intervention, eiv)
|
||||
intervention.save()
|
||||
#intervention.save()
|
||||
|
||||
num_processed += 1
|
||||
|
||||
|
@ -8,7 +8,7 @@ from konova.management.commands.setup import BaseKonovaCommand
|
||||
|
||||
|
||||
class Command(BaseKonovaCommand):
|
||||
help = "Migrates from KSP database to Konova"
|
||||
help = "Migrates from KSP to Konova"
|
||||
db_connection = None
|
||||
|
||||
def add_arguments(self, parser):
|
||||
@ -20,9 +20,9 @@ class Command(BaseKonovaCommand):
|
||||
try:
|
||||
migraters = [
|
||||
InterventionMigrater(options),
|
||||
#CompensationMigrater(options),
|
||||
#EmaMigrater(options),
|
||||
#EcoAccountMigrater(options),
|
||||
CompensationMigrater(options),
|
||||
EmaMigrater(options),
|
||||
EcoAccountMigrater(options),
|
||||
#InterventionRecordedMigrater(options),
|
||||
#UserMigrater(options),
|
||||
]
|
||||
|
Loading…
Reference in New Issue
Block a user