I not too long ago began a brand new private venture. The very first thing I do after interested by it’s to assemble an set up.php script which consists of a sequence of database calls the place it does issues like CREATE TABLE to “construct the essential basis”.
Once I felt moderately assured concerning the construction, I ran that PHP script. From that time on, I as a substitute used a GUI software program to edit/add/delete columns and constraints, as I “fine-tuned” the database whereas creating the applying.
For some time, I might edit the set up.php for every change I did by way of the GUI, as to have them completely “synced”, however after some time, as there have been extra adjustments, I mentioned: “Screw it! That is solely ever going to run on my pc anyway!” and deleted the set up.php.
Now, I am reaching some sort of “completed” state for the applying, and notice that, after deleting the dummy information, varied serials/bigserials at the moment are beginning at excessive numbers (as a substitute of zero or 1, as they do from the start). In fact, this implies no sensible downside, however it’s psychologically very annoying to know that you just began the “manufacturing utility” with “non-vanilla” inner counters.
Is there a function in PostgreSQL which mechanically sees to it that any information remaining within the tables of the given database is “pulled again down” so that they get ids like 1, 2, three as a substitute of 6732, 6733, 6734, and many others.? That’s, not nuking the database/tables, however intelligently “resetting” them on this logical method? I additionally surprise if different databases have this function.
Observe: I’ve overseas keys and first keys and uniques and such all arrange, so this could technically be attainable with out messing up the “relations” when the ids change.
I wager there is no such factor. Could be very nice if such is the case, although. Like a “database serial defragmenter” of kinds. It could even be smart to run on a product database when you have deleted big quantities of information for some motive, so that you just by no means attain the utmost for a “serial” (integer).