Ask: how to update last_topic_id of a category

Here is a category contains series of topics

categories: topics_count: int64, last_topic_id: string

How can I update category’s last_topic_id and topics_count, when i change topic’s category or delete the topic?

Hi

It is really hard to answer your question without more information. Could you describe your problem more precisely and post some code also.

Thanks, I doing something like https://github.com/discourse/discourse did.

A forum contains many categories with some topics, a category has some field topics_count, last_topic_id etc.

when i change the topic’s category, or delete a topic, should update the category’s topics_count, last_topic_id

Am i clear? thanks

You can do this either with a trigger at the DB level, or programmatically. Have you tried any approach? What have you done already?

Yeah, maybe i should try programmatically, thanks

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.