News:

Want to get involved in developing SMF, then why not lend a hand on our github!

Main Menu

What determines message ID for new posts?

Started by asura88, June 23, 2014, 09:34:12 AM

Previous topic - Next topic

asura88

I've been making some guide topics on my forum and since I lacked out of space, I decided make new post at the end, after the comments of my members and make this post right after my guide posts. To do this I switched around message IDs and put some really high IDs (just temporary) of some posts in the smf_messages table to be able to set new order, since I had to make these IDs free first.

And after few days I noticed that all new posts come out with ridiculously high message IDs. It doesn't really do any harm and loading backup isn't worth it, but it bothers me and I would like to fix it.

So I updated the message IDs to the correct ones in the following tables:

smf_topics - id_first_msg, id_last_msg
smf_messages - id_msg, id_msg_modified
smf_boards - id_last_msg, id_msg_updated
smf_attachments - id_msg
smf_log_reported - id_msg
smf_log_search_results - id_msg
smf_approval_queue - id_msg
smf_members - id_msg_last_visit

and the following:
smf_log_digest
smf_log_mark_read
smf_log_topics
smf_log_boards
smf_log_reported
smf_log_reported_comments


These are all tables that contain message IDs that I could find. But problem still persisted, all new posts still come out with super high ID, even though the max msg ID in the smf_messages table and all others were correct.  So my question is what determines message ID for new posts? What did I miss?  Sorry for super awkward problem  >:

margarett

Ids are automatically attributed with each created post. There's an auto-increment record for this.
When you manually set high ids, you modified the auto increment value and now that's the reference for new posts.

You should not really change the database like that...
Se forem conduzir, não bebam. Se forem beber... CHAMEM-ME!!!! :D

QuoteOver 90% of all computer problems can be traced back to the interface between the keyboard and the chair

asura88

Yes, changing these IDs wasn't smart, but is there a way to change this auto-increment record back without loading a backup? I have a test forum where I could test it.

Kindred

not easily... because it is unlikely that the IDs were all in order...   there probably were missing numbers where posts had been deleted -- and you adding ridiculous high IDs has created a large gap...   which could haven been rectified right away, but now that there are other real messages have been added, you're SoL...

and by doing so, you have made things more difficult in the future.
Your best option is to restore a backup... but that would, of course, lose all of the data since the last backup.
Слaва
Украинi

Please do not PM, IM or Email me with support questions.  You will get better and faster responses in the support boards.  Thank you.

"Loki is not evil, although he is certainly not a force for good. Loki is... complicated."

margarett

Quote from: asurapw88 on June 23, 2014, 10:05:14 AM
Yes, changing these IDs wasn't smart, but is there a way to change this auto-increment record back without loading a backup? I have a test forum where I could test it.
You can change the auto-increment, yes. Eg:
ALTER TABLE smf_messages AUTO_INCREMENT = xxxx
where "xxxx" is the ID of the LAST existing message + 1.
But as Kindred says, you now have already some newer posts. That link to smf_topics, amongst other tables. It's really a bad idea to continue to mess this up :P
So, you either continue as you have it now (not a big problem, methinks) or you restore your backup.
Se forem conduzir, não bebam. Se forem beber... CHAMEM-ME!!!! :D

QuoteOver 90% of all computer problems can be traced back to the interface between the keyboard and the chair

asura88


Advertisement: