Philipp Hörist pushed to branch reactions at gajim / gajim
Commits:
16cb640e by Philipp Hörist at 2024-05-19T22:53:16+02:00
refactor: Rename index
- - - - -
8883967a by Philipp Hörist at 2024-05-19T22:54:15+02:00
new: Add DB Migration
- - - - -
3 changed files:
- gajim/common/storage/archive/migration.py
- gajim/common/storage/archive/models.py
- gajim/common/storage/archive/storage.py
Changes:
=====================================
gajim/common/storage/archive/migration.py
=====================================
@@ -116,6 +116,8 @@ def __init__(self, archive: AlchemyStorage, user_version:
int) -> None:
self._v9()
if user_version < 10:
self._v10()
+ if user_version < 11:
+ self._v11()
app.ged.raise_event(DBMigrationFinished())
@@ -266,6 +268,10 @@ def _v10(self) -> None:
'PRAGMA user_version=10'
])
+ def _v11(self) -> None:
+ mod.Base.metadata.create_all(self._engine)
+ self._execute_multiple(['PRAGMA user_version=11'])
+
def _process_archive_row(
self,
conn: sa.Connection,
=====================================
gajim/common/storage/archive/models.py
=====================================
@@ -555,7 +555,7 @@ class Reaction(MappedAsDataclass, Base, UtilMixin,
kw_only=True):
__table_args__ = (
Index(
- 'idx_reaction',
+ 'idx_reaction_id',
'id',
'fk_remote_pk',
'fk_account_pk',
@@ -564,7 +564,7 @@ class Reaction(MappedAsDataclass, Base, UtilMixin,
kw_only=True):
sqlite_where=fk_occupant_pk.is_(None),
),
Index(
- 'idx_reaction_gc',
+ 'idx_reaction_id_gc',
'id',
'fk_remote_pk',
'fk_occupant_pk',
@@ -575,13 +575,6 @@ class Reaction(MappedAsDataclass, Base, UtilMixin,
kw_only=True):
),
)
- def get_select_stmt(self) -> Select[Any]:
- return select(Reaction).where(
- Reaction.id == self.id,
- Reaction.fk_remote_pk == self.fk_remote_pk,
- Reaction.fk_account_pk == self.fk_account_pk,
- )
-
class Message(MappedAsDataclass, Base, UtilMixin, kw_only=True):
__tablename__ = 'message'
=====================================
gajim/common/storage/archive/storage.py
=====================================
@@ -54,7 +54,7 @@
from gajim.common.storage.base import with_session
from gajim.common.util.datetime import FIRST_UTC_DATETIME
-CURRENT_USER_VERSION = 10
+CURRENT_USER_VERSION = 11
log = logging.getLogger('gajim.c.storage.archive')
View it on GitLab:
https://dev.gajim.org/gajim/gajim/-/compare/1f57ac3bcf70cf9867ab20386c3acefe6eed0bc0...8883967ac6941b7283b6595f339d97b7e89d7d5c
--
View it on GitLab:
https://dev.gajim.org/gajim/gajim/-/compare/1f57ac3bcf70cf9867ab20386c3acefe6eed0bc0...8883967ac6941b7283b6595f339d97b7e89d7d5c
You're receiving this email because of your account on dev.gajim.org.
_______________________________________________
Commits mailing list -- [email protected]
To unsubscribe send an email to [email protected]