mirror of
https://github.com/Sheldan/Sissi.git
synced 2026-01-26 19:21:43 +00:00
[SIS-xxx] adding sync of starboard posts and quotes, including migration script
This commit is contained in:
@@ -0,0 +1,29 @@
|
||||
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
|
||||
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
|
||||
""")
|
||||
rs = conn.execute(squery)
|
||||
found_posts = []
|
||||
for post in rs:
|
||||
found_posts.append({
|
||||
'post_id': post[0],
|
||||
'channel_id': post[2],
|
||||
'message_id': post[4],
|
||||
'adder_id': post[5],
|
||||
'author_id': post[1],
|
||||
'server_id': post[3],
|
||||
'created': post[6]
|
||||
})
|
||||
return found_posts
|
||||
Reference in New Issue
Block a user