Browse Source

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!
merge-requests/106/head
Deimos 4 years ago
parent
commit
080aadb131
  1. 10
      tildes/alembic/versions/468cf81f4a6b_topic_schedule_add_latest_topic_id.py

10
tildes/alembic/versions/468cf81f4a6b_topic_schedule_add_latest_topic_id.py

@ -28,6 +28,16 @@ def upgrade():
["topic_id"], ["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( op.execute(
""" """
create or replace function update_topic_schedule_latest_topic_id() returns trigger as $$ create or replace function update_topic_schedule_latest_topic_id() returns trigger as $$

Loading…
Cancel
Save