Resetting the Image numbers r4602
-
At work, our image IDs have reached into the 100s, it’s kinda ridiculous… because the lowest one is in the 80s I think.
I just reset my image IDs at home, going to try it at work tomorrow. Here’s what I did.
Figured out what my lowest Image ID was with this:
SELECT imageID FROM images ORDER BY imageID LIMIT 1;
The above query returned “7” for me on my home FOG server.
Then reset my image IDs in the images table, the imageGroupAssoc table, and the hosts table like this using the information provided by the previous query.
UPDATE images SET imageID = imageID - 7; UPDATE imageGroupAssoc SET igaImageID = igaImageID - 7; UPDATE hosts SET hostImage = hostImage - 7;
I then reset the auto-increment on the images table like this:
ALTER TABLE images AUTO_INCREMENT = 1;
I’d like for one of the @Developers or @Moderators confirm or deny that I’ve done this correctly and it won’t cause any issues. Everyone else is of course welcome to chime in as well.
it SEEMS to have worked… but I’m asking to be safe…
Thanks.
-
Following up here (a year later, yes I’m terrible).
I did this at work, it went fine.
Also, here’s a related thread that deals with the same issue but had problems:
https://forums.fogproject.org/topic/8762/change-image-id-number#wiki worthy
-
@wayne-workman said in Resetting the Image numbers r4602:
SELECT imageID FROM images ORDER BY imageID LIMIT 1;
Can I just say thank you for this.
-
FYI, there is now a tool that can renumber your images for you, here it is:
https://github.com/FOGProject/fog-community-scripts/tree/master/RenumberImageIDs