PDA

View Full Version : changing values in the tables


Martin
Wed 12th Jul '00, 8:26pm
okay, here's a toughie (at least for me)

As some of you know, I had a HUGE crash a few weeks ago that crashed my database and cost me 100k+ posts and sent my users into a frenzy.

Anyway, after puring thru all the files by hand, I finally got rid of all the corrupted data and have a functioning database again.

This is where my problem lies:

I want to combine the old post and thread data with the new. the easiest way to do that, as I see it, would be to do a dump on the existing (new) databases and import it into the old.

The problem is, we started a gain from scratch, so I will have duplicate threadids and postids.

Is there a query I can run to add a number to the threadid columns in the thread and post tables and the postid column in the post table?

Say I had 2500 threads and 25000 posts I needed to renumber. How would I go about that? PLease tell me there's a simple query I can run?

Second, mysqlimport seems to be importing the data okay (I've been playing with it) but it doesn't show up in the program. All I can see is the data that was there before the import, none of the imported data is showing, though the files do increase proportionately in size. Am I doing something wrong?

I'm running it like this:
mysqlimport -r temp post.sql
mysqlimport -r temp thread.sql

doron
Thu 13th Jul '00, 4:52am
Is there a query I can run to add a number to the threadid columns in the thread and post tables and the postid column in the post table?

Say I had 2500 threads and 25000 posts I needed to renumber. How would I go about that? PLease tell me there's a simple query I can run?

Ok, here is what I would do. Close the board, and

alter table post set postid = postid+$oldnum

where oldnum is the biggest postid in the lost info you retrieved. this means, if the last post you were able to save was 3400, the db would now contain postids 3401 and above, meaning you can easily insert the old posts, which would be 1-3400.

same would go for thread. this this is not a flat text db, this should cause no problems for the board.

Jet
Tue 13th Nov '01, 4:32pm
Excuse the intrusion.
I have the same problem (with an incomplete post import feature from Ikonboard with different forums).

I red your solution with a lot of interest because seemed a genial one, but looking at the ERD schema of the database, I notice that (apart from polls and other empty tables at startup time), the threadid is the foreign key joining the post and thread tables.

So, how can I do this renumbering when it affects at least those two essential tables ?
Should I apply the same increment in both tables to the same field ?

Again, can I be sure the threadid and the postid - in an empty post database - are only joined themselves without any external reference ? This case, with a lot of patience, I could renumber manually all the fields in these 2 tables for example working with sql/csv dumps into Excel... :)

Thank you very much for your support.
Bye