slidge 0.3.0a0__py3-none-any.whl → 0.3.0a2__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- slidge/db/alembic/versions/4dbd23a3f868_new_avatar_store.py +49 -0
- slidge/db/store.py +6 -4
- {slidge-0.3.0a0.dist-info → slidge-0.3.0a2.dist-info}/METADATA +1 -1
- {slidge-0.3.0a0.dist-info → slidge-0.3.0a2.dist-info}/RECORD +8 -8
- {slidge-0.3.0a0.dist-info → slidge-0.3.0a2.dist-info}/WHEEL +1 -1
- {slidge-0.3.0a0.dist-info → slidge-0.3.0a2.dist-info}/entry_points.txt +0 -0
- {slidge-0.3.0a0.dist-info → slidge-0.3.0a2.dist-info}/licenses/LICENSE +0 -0
- {slidge-0.3.0a0.dist-info → slidge-0.3.0a2.dist-info}/top_level.txt +0 -0
@@ -19,6 +19,11 @@ depends_on: Union[str, Sequence[str], None] = None
|
|
19
19
|
|
20
20
|
|
21
21
|
def upgrade() -> None:
|
22
|
+
# a bug in slidge v0.3.0alpha0 lead to a crash during this migration which ended up with
|
23
|
+
# this temporary tables in here
|
24
|
+
op.execute("DROP TABLE IF EXISTS _alembic_tmp_avatar;")
|
25
|
+
op.execute("DROP TABLE IF EXISTS _alembic_tmp_contact;")
|
26
|
+
|
22
27
|
with op.batch_alter_table("avatar", schema=None) as batch_op:
|
23
28
|
batch_op.add_column(sa.Column("legacy_id", sa.String(), nullable=True))
|
24
29
|
batch_op.create_unique_constraint("avatar_unique_legacy_id", ["legacy_id"])
|
@@ -37,6 +42,50 @@ def upgrade() -> None:
|
|
37
42
|
WHERE avatar.id = room.avatar_id
|
38
43
|
""")
|
39
44
|
|
45
|
+
# the following 4 OPs have been added manually because somewhere before, we messed up
|
46
|
+
# and the client_type server side default value was pc (no quote) instead of "pc"
|
47
|
+
op.execute(
|
48
|
+
"""
|
49
|
+
CREATE TABLE contact_new (
|
50
|
+
id INTEGER NOT NULL,
|
51
|
+
user_account_id INTEGER NOT NULL,
|
52
|
+
legacy_id VARCHAR NOT NULL,
|
53
|
+
jid TEXT NOT NULL,
|
54
|
+
avatar_id INTEGER,
|
55
|
+
nick VARCHAR,
|
56
|
+
cached_presence BOOLEAN NOT NULL,
|
57
|
+
last_seen DATETIME,
|
58
|
+
ptype VARCHAR,
|
59
|
+
pstatus VARCHAR,
|
60
|
+
pshow VARCHAR,
|
61
|
+
is_friend BOOLEAN NOT NULL,
|
62
|
+
added_to_roster BOOLEAN NOT NULL,
|
63
|
+
extra_attributes VARCHAR,
|
64
|
+
updated BOOLEAN NOT NULL,
|
65
|
+
caps_ver VARCHAR,
|
66
|
+
vcard VARCHAR,
|
67
|
+
vcard_fetched BOOLEAN DEFAULT 1 NOT NULL,
|
68
|
+
avatar_legacy_id VARCHAR,
|
69
|
+
client_type VARCHAR(8) DEFAULT 'pc' NOT NULL,
|
70
|
+
PRIMARY KEY (id),
|
71
|
+
FOREIGN KEY(user_account_id) REFERENCES user_account (id),
|
72
|
+
FOREIGN KEY(avatar_id) REFERENCES avatar (id),
|
73
|
+
UNIQUE (user_account_id, legacy_id) CONSTRAINT uq_user_account_legacy_id,
|
74
|
+
UNIQUE (user_account_id, jid) CONSTRAINT uq_user_account_jid
|
75
|
+
);
|
76
|
+
"""
|
77
|
+
)
|
78
|
+
|
79
|
+
op.execute(
|
80
|
+
"""
|
81
|
+
INSERT INTO contact_new (id, user_account_id, legacy_id, jid, avatar_id, nick, cached_presence, last_seen, ptype, pstatus, pshow, is_friend, added_to_roster, extra_attributes, updated, caps_ver, vcard, vcard_fetched, avatar_legacy_id, client_type)
|
82
|
+
SELECT id, user_account_id, legacy_id, jid, avatar_id, nick, cached_presence, last_seen, ptype, pstatus, pshow, is_friend, added_to_roster, extra_attributes, updated, caps_ver, vcard, vcard_fetched, avatar_legacy_id, client_type
|
83
|
+
FROM contact;
|
84
|
+
"""
|
85
|
+
)
|
86
|
+
op.execute("DROP TABLE contact;")
|
87
|
+
op.execute("ALTER TABLE contact_new RENAME TO contact;")
|
88
|
+
|
40
89
|
with op.batch_alter_table("contact", schema=None) as batch_op:
|
41
90
|
batch_op.drop_column("avatar_legacy_id")
|
42
91
|
|
slidge/db/store.py
CHANGED
@@ -324,9 +324,10 @@ class MAMStore:
|
|
324
324
|
if before_id is not None:
|
325
325
|
stamp = session.execute(
|
326
326
|
select(ArchivedMessage.timestamp).where(
|
327
|
-
ArchivedMessage.stanza_id == before_id
|
327
|
+
ArchivedMessage.stanza_id == before_id,
|
328
|
+
ArchivedMessage.room_id == room_pk,
|
328
329
|
)
|
329
|
-
).
|
330
|
+
).scalar_one_or_none()
|
330
331
|
if stamp is None:
|
331
332
|
raise XMPPError(
|
332
333
|
"item-not-found",
|
@@ -336,9 +337,10 @@ class MAMStore:
|
|
336
337
|
if after_id is not None:
|
337
338
|
stamp = session.execute(
|
338
339
|
select(ArchivedMessage.timestamp).where(
|
339
|
-
ArchivedMessage.stanza_id == after_id
|
340
|
+
ArchivedMessage.stanza_id == after_id,
|
341
|
+
ArchivedMessage.room_id == room_pk,
|
340
342
|
)
|
341
|
-
).
|
343
|
+
).scalar_one_or_none()
|
342
344
|
if stamp is None:
|
343
345
|
raise XMPPError(
|
344
346
|
"item-not-found",
|
@@ -53,7 +53,7 @@ slidge/db/__init__.py,sha256=EBDH1JSEhgqYcli2Bw11CRC749wJk8AOucgBzmhDSvU,105
|
|
53
53
|
slidge/db/avatar.py,sha256=MXFd1oe0eL5CCUYbc5CpsIcbio3cY3xVoKt39RAoj9I,8240
|
54
54
|
slidge/db/meta.py,sha256=NtjGWcqPfG7uPfwR_cC6_23zyo8ftqgKX8CbP9IBq6U,2185
|
55
55
|
slidge/db/models.py,sha256=xkTveglIbJDwcm1YEF7urEC1LTlwyXYrxgT4Vppdmmg,12763
|
56
|
-
slidge/db/store.py,sha256=
|
56
|
+
slidge/db/store.py,sha256=shgBqGutbAeMD6T3sqH7Qo4IKs9TWwjwfH5-NDpj-kY,19399
|
57
57
|
slidge/db/alembic/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
58
58
|
slidge/db/alembic/env.py,sha256=hsBlRNs0zF5diSHGRSa8Fi3qRVQDA2rJdR41AEIdvxc,1642
|
59
59
|
slidge/db/alembic/script.py.mako,sha256=MEqL-2qATlST9TAOeYgscMn1uy6HUS9NFvDgl93dMj8,635
|
@@ -66,7 +66,7 @@ slidge/db/alembic/versions/29f5280c61aa_store_subject_setter_in_room.py,sha256=f
|
|
66
66
|
slidge/db/alembic/versions/2b1f45ab7379_store_room_subject_setter_by_nickname.py,sha256=CMVP2wFz6s7t57eWdSaGtck8BXzfVPJhHE5AoWi34tI,1359
|
67
67
|
slidge/db/alembic/versions/3071e0fa69d4_add_contact_client_type.py,sha256=jCdwCOnX9VDgnqIFFHGKaPA7w87Hm9nvR1rMY0LrA30,1394
|
68
68
|
slidge/db/alembic/versions/45c24cc73c91_add_bob.py,sha256=UjMySZ5LaInyPt0KbAxx0rF4GQhZh8CwBeqHtNPdG1c,1249
|
69
|
-
slidge/db/alembic/versions/4dbd23a3f868_new_avatar_store.py,sha256=
|
69
|
+
slidge/db/alembic/versions/4dbd23a3f868_new_avatar_store.py,sha256=JhT83RJfXlKu2y8iB4twtuINGfa9YKNh6jURXVedHOc,4002
|
70
70
|
slidge/db/alembic/versions/54ce3cde350c_use_hash_for_avatar_filenames.py,sha256=aNwlpXCHI_TEnVt2w-C8OrdH02-FhgrKbZkEqt40ay4,1495
|
71
71
|
slidge/db/alembic/versions/58b98dacf819_refactor.py,sha256=bQG57V7b0UK6of4MdDpoBNDtPQH5AYHqAkt3RL9OmaI,5001
|
72
72
|
slidge/db/alembic/versions/5bd48bfdffa2_lift_room_legacy_id_constraint.py,sha256=m3USa76h0O2Xut-NePXIOZfkXl0bx0d5FyjOYpd34Jo,1977
|
@@ -109,9 +109,9 @@ slidge/util/lock.py,sha256=ZnUi3LGiz271-YeYKo9JzxovJCoSwlP9P65pNyHIO9o,1029
|
|
109
109
|
slidge/util/test.py,sha256=_E6er2BtQlpyzTUmp4u8C9KhBYzbLrmTwSVgxGObKHU,13988
|
110
110
|
slidge/util/types.py,sha256=xJ84ZvaUOU_VVJSjEMysgNSl05k0_O9YKbyW-JUrsMI,5635
|
111
111
|
slidge/util/util.py,sha256=4hihLCl4SsB5S14TT3bP8tDPP_Zg9rYbSfLdLB9-G_Q,9332
|
112
|
-
slidge-0.3.
|
113
|
-
slidge-0.3.
|
114
|
-
slidge-0.3.
|
115
|
-
slidge-0.3.
|
116
|
-
slidge-0.3.
|
117
|
-
slidge-0.3.
|
112
|
+
slidge-0.3.0a2.dist-info/licenses/LICENSE,sha256=DZak_2itbUtvHzD3E7GNUYSRK6jdOJ-GqncQ2weavLA,34523
|
113
|
+
slidge-0.3.0a2.dist-info/METADATA,sha256=CZbiWq5Y-njBhLaMQb03Io2iLLL6RiRkPLVh4mAEE4E,5056
|
114
|
+
slidge-0.3.0a2.dist-info/WHEEL,sha256=GHB6lJx2juba1wDgXDNlMTyM13ckjBMKf-OnwgKOCtA,91
|
115
|
+
slidge-0.3.0a2.dist-info/entry_points.txt,sha256=py3_x834fFJ2TEzPd18Wt2DnysdAfuVqJ5zzBrXbAZs,44
|
116
|
+
slidge-0.3.0a2.dist-info/top_level.txt,sha256=2LRjDYHaGZ5ieCMF8xy58JIiabRMzX-MGMbCZwfE17c,7
|
117
|
+
slidge-0.3.0a2.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|