AndyJarrett

SQL for upgrading to Blog CFC v5

I am in the middle of very slowy upgrading my blog to Rays version 5, and as usual there has been a few DB changes. Below is the SQL (for MySQL, though easily adapted) update script I'm using for the updgrade, with Rays comments about the changes included. You have to be running v4+ of BlogCFC for this to work! Before running the SQL please read through it! Along with the new table and fields there are two UPDATE statements which affects your data. Just make sure you understand what you are doing before you run it as this code comes as is, if you run the script and your computer turn into a Commodore 64 because of it, its not my fault!#tblUsers:#name(nvarchar/50) added - You should add your name here, or your code name. Or whatever you go by.ALTER TABLE `andyjarrett`.`tblusers` ADD COLUMN `name` varchar(50) NULL DEFAULT NULL;UPDATE `tblusers` SET `name`=!!PUT YOU NAME/CODE NAME HERE!! WHERE `username`=!!USERNAME HERE!! AND `password`=!!PASSWORD HERE!!;#tblBlogEntriesRelated: (New table)# entryid (nvarchar/35)# relatedid (nvarchar/35)CREATE TABLE `tblblogentriesrelated` ( `entryid` varchar(35) NOT NULL DEFAULT '', `relatedid` varchar(35) NULL DEFAULT NULL, PRIMARY KEY (`entryid`)) ENGINE=MyISAM;#tblBlogEntries:# views(int) added - You must set all old views to 0# released(bit) added - You must set your old data to released=1 with a quick query# mailed(bit) added - You can set the old ones to true, but you don't need to)ALTER TABLE `tblblogentries` ADD COLUMN `views` int(11) NOT NULL DEFAULT 0;ALTER TABLE `tblblogentries` ADD COLUMN `released` tinyint(3) NOT NULL DEFAULT 0;ALTER TABLE `tblblogentries` ADD COLUMN `mailed` tinyint(3) NOT NULL DEFAULT 1; # :::::::::::::::::::::::::::::::::: START: DATA UPDATE STATMENT :::::::::::::::::::::::::::::::::::::::::#UPDATE `tblblogentries` SET `released`=1;# :::::::::::::::::::::::::::::::::: END: DATA UPDATE STATMENT :::::::::::::::::::::::::::::::::::::::::##tblBlogCategories:# categoryalias(nvarchar/50) addedALTER TABLE `tblblogcategories` ADD COLUMN `categoryalias` varchar(50) NOT NULL; #DB CHANGE: New table, tblblogtextblocks. Columns:# id, nvarchar 35, primary key# label, nvarchar 255,# body, ntext,# blog, nvarchar 50 CREATE TABLE `tblblogtextblocks` ( `id` varchar(35) NOT NULL DEFAULT '', `label` varchar(255) NULL DEFAULT NULL, `body` text NULL, `blog` varchar(50) NULL DEFAULT NULL, PRIMARY KEY (`id`)) ENGINE=MyISAM; #DB CHANGE: New table, tblblogpages. Columns:# id, nvarchar 35, primary key# title, nvarchar 255# alias, nvarchar 100# body, ntext,# blog, nvarchar 50CREATE TABLE `tblblogpages` ( `id` varchar(35) NOT NULL DEFAULT '', `title` varchar(255) NULL DEFAULT NULL, `alias` varchar(100) NULL DEFAULT NULL, `body` text NULL, `blog` varchar(50) NULL DEFAULT NULL, PRIMARY KEY (`id`)) ENGINE=MyISAM;#DB CHANGE: Add verified as a bit to the tblblogsubscribers table. #You should write a quick script to update your current subscribers with verified=1. If you do not, they will not get email.ALTER TABLE `tblblogsubscribers` ADD COLUMN `verified` tinyint(3) NULL DEFAULT 0;# :::::::::::::::::::::::::::::::::: START: DATA UPDATE STATMENT :::::::::::::::::::::::::::::::::::::::::#UPDATE `tblblogsubscribers`SET `verified`=1# :::::::::::::::::::::::::::::::::: END: DATA UPDATE STATMENT :::::::::::::::::::::::::::::::::::::::::#