Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2014-05-14 12:50:34

Kossatsch
Member
From: St. Wolfgang
Registered: 2004-04-01
Posts: 198
Website

"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


txp at irox.de since spring 2004 (g1.17) & at roxomatic since 2006.

Offline

#2 2014-05-14 13:43:45

trenc
Plugin Author
From: Amsterdam
Registered: 2008-02-27
Posts: 571
Website GitHub

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!

Offline

Board footer

Powered by FluxBB