Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
"Clean" renumbering of old DB
Hello,
a client of mine has an existing TXP DB with articles (including comments). Now the owner wants to renumber it (in PHPadmin) and delete the number s of deleted articles, so that there is a well-sorted numbering of the remaining, not deleted articles (1, 2, 3, 4 instead of 1, 4, 6, 11 …). He does not mind of comments are lost.
How can he do that?
Best regards
Offline
Re: "Clean" renumbering of old DB
Unfortunately there is no sinlge command for this task, but something like this should work:
This deletes the current ID column of the textpattern table:
ALTER TABLE textpattern DROP ID
Then add a new ID column and with a newly build auto increment numbering:
ALTER TABLE textpattern ADD ID INT(11) NOT NULL AUTO_INCREMENT FIRST, ADD PRIMARY KEY (ID), AUTO_INCREMENT=1
Note: Please backup your data!
Digital nomad, sailing the world on a sailboat: 32fthome.com
Offline