Reset auto-incremented ID

Gramps AIO 4.5.1.5 on WIndows 11:

Is there a way to reset the autoincrement ID value for various tables? I imported a .ged, and have since deleted many entries. I’d like for my newly created entries (without a manual ID specified) to continue in sequence from a certain point.

Is there a gramplet or raw SQL to execute against the db to reset my “last” ID for a given type (person, event, etc)?

Welcome!

You could use the Tools → Family Tree Processing → Reorder Gramps IDs…, a built-in tool.


After it reorders the IDs in a category, the counter is reset.

My database has been re-ordered to a format with a couple leading zeros. My data blew through the default allocated range too quickly.

The default setting in the Reorder Gramps IDs is to standardize the IDs. To reorder the IDs (remove the gaps in the sequences) click on Change. If you are not using customized IDs for a purpose like GETGov place IDs, unselect the Keep option.

This would also be an ideal time to alter the size of the IDs. The default is the leading letter with a four-digit number (0000-9999). You can change ID’s by altering the formats from %04d to %05d or %06d, etc.

And with any batch edit process, there is no UnDo if things unexpectedly hit a snag or not as expected. Always make sure you have a recent backup of your database.

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