[SIS-xxx] making quote attachment URL column larger

changing migration script for starboard/quotes
This commit is contained in:
Sheldan
2024-07-13 00:50:45 +02:00
parent af006ee880
commit dda7ed7db8
8 changed files with 51 additions and 21 deletions

View File

@@ -2,17 +2,18 @@ from sqlalchemy.sql import text
def load_all_starboard_posts(conn):
squery = text("""select sp.id, sp.author_user_in_server_id, sp.source_channel_id, sp.server_id, sp.post_message_id, spr.reactor_user_in_server_id, sp.created
squery = text("""select distinct sp.id, sp.author_user_in_server_id, sp.source_channel_id, sp.server_id, sp.post_message_id, spr.reactor_user_in_server_id, sp.created
from starboard_post sp
inner join starboard_post_reaction spr
on sp.id = spr.post_id
and spr.created = (
select spr.created
from starboard_post_reaction spr2
where spr2.post_id = sp.id
order by created limit 1
)
where sp.ignored = false
inner join starboard_post_reaction spr
on sp.id = spr.post_id
and spr.reactor_user_in_server_id = (
select reactor_user_in_server_id
from starboard_post_reaction spr2
where spr2.post_id = sp.id
order by created limit 1
)
where sp.ignored = false
and sp.post_message_id not in (select message_id from quote)
""")
rs = conn.execute(squery)
found_posts = []