How to generate a fresh Sitefinity 5.3 DB for an existing si

Posted by Community Admin on 04-Aug-2018 13:16

How to generate a fresh Sitefinity 5.3 DB for an existing site?

All Replies

Posted by Community Admin on 13-Feb-2013 00:00

[Note: This question is re-posted with a more accurate thread subject--old thread content is removed]

What would be the best way to start out with a fresh Sitefinity 5.3 DB for an existing site? 

We're testing a lot of custom migrations, and being able to start with a clean DB as needed would help a lot.I've tried using the project manager to generate a new project, and to use its database with my existing site, but I receive the "Invalid root node configured for pages. No root node with the name of "f669d9a7-009d-4d83-ddaa-000000000001" error. Is there something I need to do to my pagesConfig.config and projectConfig.config to make this work?

Is there a better way anyone knows of to generate an empty Sitefinity DB form an existing site?

Posted by Community Admin on 13-Feb-2013 00:00

Oooh, this would help me out as well, with a little bit different scenario. I have a few sites that started with Sitefinity 4.0 and have hit every major & most minor versions until 5.3. This has come with some problems from time to time and I'm fiddling with the idea of 'resetting' a couple of them and starting fresh to clear out the db.

Posted by Community Admin on 13-Feb-2013 00:00

+1 on wanting an answer on this question.

I started my school's website back on Sitefinity 4.2 and have upgraded through ever since to version 5.1

I'd like to create a completely fresh project on version 5.4 (when it comes out), and move into its DB all of the published content, taxonomy, users, etc. from the old site.

The old site has bandaids in place that I needed to "fix" things (e.g. sorting lists alphabetically on the front-end).

I'm hoping the new version addresses some of the fixes, and with a fresh project leave those bandaids behind.

Posted by Community Admin on 14-Feb-2013 00:00

+1 as well. I have a site that was 3.5 and there's been a lot of bumps along the way of upgrades. 

Posted by Community Admin on 19-Feb-2013 00:00

In a support ticket, Victor suggested using the API to wipe everything out. We have a pretty big site (~6k pages) so the simple approach of App.WorkWith().Pages().Where(p => !p.IsBackend).Delete(); times out. However, this may work for others.

I'll post progress as I move forward with this.

Posted by Community Admin on 21-Feb-2013 00:00

I've wiped out the DB to create a fresh backup we can restore. I've just added in Take(N) to the command... for example:

App.WorkWith().Images().Take(1000).Delete().SaveChanges();

App.WorkWith().Documents().Take(100).Delete().SaveChanges();
...and so on.

And I hit refresh until they were all gone. It's crude, but I got my empty DB backup. 

Posted by Community Admin on 22-Feb-2013 00:00

Hello all,

You can actually take advantage of the built in support for FlushTransaction() which will allow you to do something similar to:

var transactionName = "CreateSomePages";
            try
            
                //Get the manager instance with a transaction name parameter
                var manager = PageManager.GetManager(null, transactionName);
                for (int i = 0; i < 1000; i++)
                
                    var page = manager.CreatePage(Telerik.Sitefinity.Fluent.Pages.PageLocation.Frontend, Guid.NewGuid(), NodeType.Standard);
                    page.Title = "PageNumber " + i.ToString();
                    //check if the number of dirty items has reached soem value
                    if (manager.Provider.GetDirtyItems().Count > 50)
                        //if true - Flush
                        TransactionManager.FlushTransaction(transactionName);
                
                //commit changes
                TransactionManager.CommitTransaction(transactionName);
 
            
            catch (Exception ex)
            
                //if commit fails, log the exception
                Log.Write(ex);
                //and revert changes done by Flush
                TransactionManager.RollbackTransaction(transactionName);
            


Kind regards,
Boyan Barnev
the Telerik team
Do you want to have your say in the Sitefinity development roadmap? Do you want to know when a feature you requested is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items

This thread is closed