Last week I announced the release of the BETA of DNN Blog. Since then there has been a “silent” release of BETA 3, which included some fixes to bugs, and issues found by beta testers as well as some that we found ourselves internally.
In this blog post I want to share a SQL script that we included in the Beta releases, one that received very little press, and as a result probably one that you never (rightfully so) paid attention to. The SQL script in question is located in the following folder: “DesktopModules/Blog/Upgrade/03.05.02_category_conversion.sql”.
What does it do?
As the name (03.05.02_category_conversion.sql) would suggest, this script will convert all the child blogs for a given Portal to categories. While you are NOT required to run this, and as a result, maintain the legacy child-blogs, you ought to be really careful when executing this script.
Please note, that once your run this THERE IS NO TURNING BACK; BACKUP YOUR DATABASE, PRIOR to executing this script in order to avoid any data loss.
In order to provide you with a transparent view of what the script really does to your data, I will outline a step-by-step execution path that it takes to wipe the slate clean and begin the process of the transforming your blog to the new categories paradigm:
- DELETES any existing CATEGORIES for a given portal.
- DELETES any existing references from BLOG POSTS to Categories.
- INSERTS any existing Child Blogs INTO the CATEGORIES table (The Child Blog’s title becomes the name of the new category).
- REFERENCES any existing POSTS found under the child blogs TO the newly created CATEGORY.
- SETS OWNERSHIP of the blog posts previously added under a child blog BACK TO THE PARENT BLOG.
- DELETES ALL CHILD BLOGS
How to run the script:
Before you begin, locate the PortalId of the portal whose blog you want to upgrade:
- At the top of the script, set the value of @portalid to the ID of your portal
- Save this script on your local machine using a descriptive name for example "myportal_03.05.02_category_conversion.sql”
- Log into your site using your HOST account
- Navigate to HOST > SQL
- Choose the file you saved using the "Browse" button
- Select "Run as script"
- Execute the SQL
At this point, child blogs are gone. Your Blog on your portal is now completely converted to the new version 04.00.00 – and once again, there is NO GOING BACK, unless you want to restore your database, of course.
Simple: automate this process. Need I say more?
We realize that this manual process is not ideal, but we simply did not get a chance to automate it yet; the bright side of it is that it forced me to write this detailed blog post which reveals exactly what goes on during the upgrade.
We hope to include the automated process in our next Beta round – oh yeah, we’re planning on more of those.
Finally, just as I mentioned in my previous blog we need you to help us test. Testing this scenario (converting child blogs to categories) is extremely important to the success of this major release, and we want to ensure that we get it right the first time!
The automated process has just been completed. In BETA 4 you’ll find a button on the Module Options page to migrate all the portal’s child blogs. Here are a few changes to the process outlined above:
- There is a warning on the button, for good measure.
- The script is non-destructive (i.e. the admin can run this process as many times as he/she wants)
- The script is in built in the module and no longer a file that needs to be executed