Gossamer Forum
Home : Products : Gossamer Links : Discussions :

Changing Field Order in Links SQL???

Quote Reply
Changing Field Order in Links SQL???
Hi All!

What I'd like to do is reposition some of my columns to organize and create a better work flow when administering links in my directory. Best Example:

By default I was using the <%Title%> column to display, The Title - And the title description goes here! With the addition of new features I decided it would be better to create a <%Title_Description%> column to display the title description separately. Adding this about 70 columns down from the Title Column throws off the work flow a bit. I'd like to have the Title_Description right under the Title Column to keep things tight.

For an answer I went search through the GT forums.

I found the topic below in the MySQLMan forum where Alex explains:

-----------------------------------------------------------------------------------------------------------------------------------------------

http://gossamer-threads.com/...earch_string;#132556

Hi,

Your best bet is to SQL Dump your database making sure you have extended insert selected. Then edit the file and change the order in the CREATE TABLE statement. Then run the file and it will be updated.

Cheers,

Alex

--
Gossamer Threads Inc.

-----------------------------------------------------------------------------------------------------------------------------------------------

Because this topic was in the MySQLMan forum I wanted to check with you guys to make sure this method of rearranging columns would work in Links SQL 2.1.1. The simple copy/paste editing and import of a SQL Dump just seems to easy. I'm just hoping it is though Sly ! I just don't want to go making these changes to later realize the columns rely on other dependencies in Links SQL causing this not to work.

Many thanks for any info on this! I'm sure this info would be valuable to those with messy tables.

Ryan Jonze
Quote Reply
Re: [Jonze] Changing Field Order in Links SQL??? In reply to
Hi,

If you are just adding a column to one of the tables, the easiest way I have found is to do it through MySQLMan - you can choose where you want to add the new column and if you then resync the database in your admin panel it all seems to work fine.

Laura.
The UK High Street
Quote Reply
Re: [afinlr] Changing Field Order in Links SQL??? In reply to
Thanks ever so much once again Laura! Wink

With that little tip I can go ahead and delete the columns that I haven't began to store data in. Then add the columns once again in the correct position. That will give me a good start to getting some of these misplaced columns in order. Nice tip to know when adding new columns!

In a few cases I've began to store data in a few of these colums that I'd like to move. I've been "primeing the pump" so to speak while developing. It's just too much to try and restore by hand if I wanted to delete the column.

If anyone could verify a method of moving columns such as the SQL Dump, edit, and Import method like I mentioned below that would be great!

Ryan Jonze
Quote Reply
Re: [Jonze] Changing Field Order in Links SQL??? In reply to
Adding the new columns through MySQLMan with the ADD FIELD option worked like a charm!

Thanks again Laura.

Now if I can just figure out how to move the ones with data Crazy
Quote Reply
Re: [Jonze] Changing Field Order in Links SQL??? In reply to
That's what the "pos" field in the .def file is for. It determines the order in which they will be displayed in the admin, or other automatically generated lists.

There's not automatic way to do it (ie: rearrange the list), but if you carefully edit your .def file, you can can reorder the columns display.


PUGDOG� Enterprises, Inc.

The best way to contact me is to NOT use Email.
Please leave a PM here.
Quote Reply
Re: [pugdog] Changing Field Order in Links SQL??? In reply to
I also tried modifying the "pos" field in the def files. I would work, but when I do resync database, I was lost again....

Ivan
-----
Iyengar Yoga Resources / GT Plugins
Quote Reply
Re: [yogi] Changing Field Order in Links SQL??? In reply to
I read a lot of forum threads about this some time ago and it did seem that you can't change the position by editing the def file - it would be very nice if you could! You could always add a new column where you want it and copy all the info from the old column into it using something like

UPDATE Links SET New_Column_Name = Old_Column_Name

in the SQL Monitor. My SQL knowledge isn't very good so someone may need to correct this. Also, you won't be able to give it exactly the same name as the existing column using this method.

Laura.
The UK High Street
Quote Reply
Re: [afinlr] Changing Field Order in Links SQL??? In reply to
I think that will do it Laura, Thanks MUch! Time to copy a few columns..

Ryan
Quote Reply
Re: [afinlr] Changing Field Order in Links SQL??? In reply to
You could actually create a temporary column like this, then copy the values into it. Aftwards, delete your original column, and create a new column (with the same name as the original column) at the place you want it. Then copy the data from the temporary column into the new column.

Ivan
-----
Iyengar Yoga Resources / GT Plugins
Quote Reply
Re: [yogi] Changing Field Order in Links SQL??? In reply to
It would *have* to be lost in a "resync", but you should only have to resync if you screw something up, or make changes not through the Links Admin.


PUGDOG� Enterprises, Inc.

The best way to contact me is to NOT use Email.
Please leave a PM here.