Pamhyr: Database: Update data dictionary and some change to prepare db

0.1.0.
This commit is contained in:
Pierre-Antoine Rouby committed 2024-07-23 14:15:46 +02:00
1 parent d78d9167a0
commit 5c4948bd6d
25 files changed
+426 -182

No files matched your search

+17 -1
View File
@@ -272,7 +272,23 @@ class Study(SQLModel):
"INSERT INTO info VALUES ('study_release', '0')"
)
if self._update_submodel(version[0]):
if int(minor) < 1:
# Need to temporary disable the sqlite foreign keys
# checking to update db dans change the table id fk to
# table pamhyr_id fk
self.execute(
"PRAGMA foreign_keys = OFF;"
)
ok = self._update_submodel(version[0], data={})
if int(minor) < 1:
# Reactivate foreign keys checking
self.execute(
"PRAGMA foreign_keys = ON;"
)
if ok:
self.execute(
f"UPDATE info SET value='{self._version}' WHERE key='version'"
)