mirror of https://gitlab.com/pamhyr/pamhyr2
Adists: Fix update.
parent
3ef13666dc
commit
072840a18c
|
|
@ -82,8 +82,11 @@ class D90AdisTS(SQLSubModel):
|
|||
if not created:
|
||||
cls._db_update_to_0_2_0(execute, data)
|
||||
|
||||
if not created:
|
||||
return cls._update_submodel(execute, version, data)
|
||||
|
||||
return True
|
||||
|
||||
@classmethod
|
||||
def _db_update_to_0_2_0(cls, execute, data):
|
||||
table = "d90_adists"
|
||||
|
|
@ -184,7 +187,7 @@ class D90AdisTS(SQLSubModel):
|
|||
|
||||
data['d90_default_id'] = self.id
|
||||
execute(
|
||||
"DELETE FROM d90_spec " +
|
||||
"DELETE FROM d90_adists_spec " +
|
||||
f"WHERE d90_default = {self.id} " +
|
||||
f"AND scenario = {self._status.scenario_id} "
|
||||
)
|
||||
|
|
|
|||
|
|
@ -88,8 +88,11 @@ class DIFAdisTS(SQLSubModel):
|
|||
if not created:
|
||||
cls._db_update_to_0_2_0(execute, data)
|
||||
|
||||
if not created:
|
||||
return cls._update_submodel(execute, version, data)
|
||||
|
||||
return True
|
||||
|
||||
@classmethod
|
||||
def _db_update_to_0_2_0(cls, execute, data):
|
||||
table = "dif_adists"
|
||||
|
|
|
|||
|
|
@ -230,8 +230,11 @@ class LateralContributionAdisTS(SQLSubModel):
|
|||
)
|
||||
""")
|
||||
|
||||
if ext != "":
|
||||
return True
|
||||
|
||||
return cls._create_submodel(execute)
|
||||
|
||||
@classmethod
|
||||
def _db_update(cls, execute, version, data=None):
|
||||
major, minor, release = version.strip().split(".")
|
||||
|
|
@ -246,8 +249,11 @@ class LateralContributionAdisTS(SQLSubModel):
|
|||
if not created:
|
||||
cls._db_update_to_0_2_0(execute, data)
|
||||
|
||||
if not created:
|
||||
return cls._update_submodel(execute, version, data)
|
||||
|
||||
return True
|
||||
|
||||
@classmethod
|
||||
def _db_update_to_0_2_0(cls, execute, data):
|
||||
table = "lateral_contribution_adists"
|
||||
|
|
|
|||
|
|
@ -171,6 +171,9 @@ class Layer(SQLSubModel):
|
|||
f"SELECT pamhyr_id, sl FROM {table}"
|
||||
)
|
||||
|
||||
if els is None:
|
||||
return True
|
||||
|
||||
for row in els:
|
||||
it = iter(row)
|
||||
pid = next(it)
|
||||
|
|
|
|||
|
|
@ -303,6 +303,9 @@ class SQLSubModel(PamhyrID):
|
|||
f"SELECT pamhyr_id, reach FROM {table}"
|
||||
)
|
||||
|
||||
if els is None:
|
||||
return True
|
||||
|
||||
for row in els:
|
||||
it = iter(row)
|
||||
pid = next(it)
|
||||
|
|
@ -317,6 +320,8 @@ class SQLSubModel(PamhyrID):
|
|||
f"WHERE pamhyr_id = {pid}"
|
||||
)
|
||||
|
||||
return True
|
||||
|
||||
@classmethod
|
||||
def _db_update_to_0_1_1_assoc_section_from_rk(
|
||||
cls, execute, table,
|
||||
|
|
|
|||
|
|
@ -64,6 +64,9 @@ class PamhyrID(object):
|
|||
id2pid = cls.update_db_add_pamhyr_id_init_id2pid(table, data)
|
||||
rows = execute(f"SELECT id FROM {table}")
|
||||
|
||||
if rows is None:
|
||||
return True
|
||||
|
||||
for row in rows:
|
||||
id = row[0]
|
||||
pid = cls.get_new_pamhyr_id(-1)
|
||||
|
|
|
|||
Loading…
Reference in New Issue