1 edb Jan 09, 2007 23:34
3 edb Jan 14, 2007 22:01
Original:
function GetDbLayout() {
return array(
"CREATE TABLE IF NOT EXISTS ".$this->get_sql_table('Keywords')." (
keyword varchar(50) COLLATE latin1_general_cs default '',
linkurl varchar(255) NOT NULL default '',
titletag varchar(80) NOT NULL default '',
PRIMARY KEY (keyword)
)",
);
}
Replaced with:
function GetDbLayout() {
return array(
"CREATE TABLE IF NOT EXISTS ".$this->get_sql_table('Keywords')." (
ID int(10) unsigned NOT NULL auto_increment,
keyword varchar(50) default '',
linkurl varchar(255) NOT NULL default '',
titletag varchar(80) NOT NULL default '',
PRIMARY KEY (ID)
)",
);
}
MySQL Version: 4.0.27. phpinfo show some other stuff about mysql but I don't know what else might be valuable so I'll leave it at that.
I got the "collate latin1_general_cs thing from searching the web a bit for a way to make a field not be case insensitive, and it worked for me so I was happy. A bit worried that maybe it won't work everywhere b2evo works, and that became obvious shortly after releasing the plugin. Adding an ID and making it be the primary key (then putting in an 'edit' link next to each keyword) became the solution, but I got the error you see in this thread when I changed the version and tried to enable the plugin again. The solution to this problem was the thing that both you and Yabba showed me about using PluginVersionChanged with an if(version_compare) thing and a temporary table to hold the contents before dropping the old table and replacing it with the new layout.
4 blueyed Jan 14, 2007 23:03
The primary key issue is fixed: http://evocms.cvs.sourceforge.net/evocms/b2evolution/blogs/inc/_misc/_upgrade.funcs.php?r1=1.22.2.2&r2=1.22.2.3&pathrev=v-1-9
Unfortunately the COLLATE stuff isn't trivial and therefor I've not changed it, apart from adding a note to db_delta(): it gets ignored/not changed.
5 edb Jan 15, 2007 13:13
Cool. When I did that collate thing I had a nagging doubt in the back of my mind because I hadn't seen it in b2evo, but for some reason I was convinced the best way to edit a keyword was to type it in again. In fact that's a horrible way to edit something. Clicking the 'edit' link is much easier for the user, so that's where I'm at now with that plugin.
Hey good news on the improvement. I'm looking forward to 1.9.2 because my 1.8.6 installation is starting to feel old ... ;)
EdB, please post the CREATE TABLE statements you've used before and after the change.
While you're at it, the MySQL server version would be helpful, too.