Jul 20, 2003, 5:35 AM
Veteran / Moderator (6956 posts)
Jul 20, 2003, 5:35 AM
Post #3 of 4
Views: 2342
If you want to actually reorder your database, the best thing to do is dump/export the data from MySQL Man, where you export just that table, and you export the data with all fields named (the really big export).
Check dump-to-file (so you have it)
Check dump selected tables only, and check the table you want
Check WRITE CREATE TABLE statements, but do *NOT* add a drop table. This is your backup if something goes wrong.
check write INSERT statements and "use Insert statements that name each column to be inserted" the --complete-insert
Then dump the file.
Copy the file to your computer, and look at it in an editor. Make sure you really have all your data.
Now,
Go back to the dump screen, and check "dump to screen".
Select the table again, as before.
Check write create table statement, and drop-table if it exists.
Check DO NOt write table data (--no-data)
----- you just want to get the table SQL create schema codes.
Now, cut/paste the screen dump to an editor, and you can move the lines around. If you have an ID field, I would suggest leaving that as field #1, since it's the unique identifier.
(DO NOT CHANGE ANY NAMES! Just move fields -- whole lines -- around.)
***CHECK*** the create-indexes code, since sometimes the program does not get it right, and you have to manually recreate the indexes. If you don't know what this means, ask before doing it! <G>
Now, comes the part you want to hold your beath for <G>
From the MySQL Man screen, DROP the table -- make it go bye bye.
Now, in the SQL Monitor area, paste in the altered table code, with the fields in the right order. With luck, you'll get no errors.
This will create the new table with the fields in the order you want.
Now... go back to the Links Admin, and pick the table (I'm assuming you are altering your Links table,a nd it shows up on the database page). Pick PROPERTIES and RESYNC the .def files for that table. this is ****VERY**** important! Your old def file is all messed up compared to the new table, and before you do ANYTHING to your Links site, you need to update that def file.
Make sure the new layout on the screen is how you envisioned it, and it's what you wanted.
Now, reimport your data. You can go to the MySQLMan SQLMonitor page and "run queries saved in a file" and use the file on your server, or your harddrive (remember, you did make that backup!). Because you saved the data naming each column, the import will put the data in the right places in the new layout -- as long as you updated your .def file!
Easy, right??
Do it all the time ;)
PUGDOG� Enterprises, Inc.
The best way to contact me is to NOT use Email.
Please leave a PM here.