mirror of
https://gitlab.com/tildes/tildes.git
synced 2026-04-16 06:18:34 +02:00
Add backfill for topic_schedule.latest_topic_id
I doubt the absence of this would have ever been noticed or that adding this will ever matter for anyone, but I might as well do it properly!
This commit is contained in:
@@ -28,6 +28,16 @@ def upgrade():
|
||||
["topic_id"],
|
||||
)
|
||||
|
||||
op.execute(
|
||||
"""
|
||||
update topic_schedule set latest_topic_id = (
|
||||
select topic_id from topics
|
||||
where schedule_id = topic_schedule.schedule_id
|
||||
order by created_time desc limit 1
|
||||
)
|
||||
"""
|
||||
)
|
||||
|
||||
op.execute(
|
||||
"""
|
||||
create or replace function update_topic_schedule_latest_topic_id() returns trigger as $$
|
||||
|
||||
Reference in New Issue
Block a user