DragonPrime - LoGD Resource Community
Welcome Guest
  • Good evening, Guest.
    Please log in, or register.
  • April 25, 2017, 09:07:08 PM
Home Forums News Links Downloads Login Register Advanced Search
* * *
DragonPrime Menu
Resource Pages
IRC Channels

Pages: [1]   Go Down
Author Topic: synctable(); Help  (Read 735 times)
0 Members and 1 Guest are viewing this topic.
Mod God
Offline Offline

Posts: 1016

Zeno's Arrow never hits the mark.

View Profile
« on: June 18, 2011, 07:31:26 PM »

I was recently made aware of the synctable() function and that I should use that instead of using direct SQL with db_query to create tables. I have a question... Will it also update the table if it already exists? If so, how would I use it to change the name of a column? I have "gender" and "description" that I want to change to "sex" and "desc" in the "deities" table. Please and thank you Smiley

(I don't know how to use it, but I do have an example that I am learning from that Afkamm posted in Stephen's Changelog module discussion)

My Mods
I'm not currently a fully active member of DP, though I do respond to most PMs.
Mod God
Offline Offline

Posts: 564

View Profile
« Reply #1 on: June 19, 2011, 02:48:25 AM »

I'm afraid that synctable() isn't smart enough to know how to rename columns -- it only accepts a table description, not an alteration.  So if you gave it a descriptor with different column names it will remove the old columns and add ones with the new names, but it won't know (and there's no way to tell it) that any data in them should be retained.

This makes it suitable for use in installations to create tables or update them with new columns, but not suitable for column renames.
Pages: [1]   Go Up
Jump to:  

DragonPrime Notices
Play LoGD on Dragonprime

Support Us
No funds raised yet this year
Your help is greatly appreciated!
Who's Online
20 Guests, 0 Users
DragonPrime LoGD
Recent Topics
Home Forums News Links Downloads Login Register Advanced Search