More in this section

Forums / Developing with Sitefinity / How to generate a fresh Sitefinity 5.3 DB for an existing site?

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

7 posts, 1 answered
  1. Connections Academy Developer
    Connections Academy Developer avatar
    151 posts
    Registered:
    04 May 2005
    13 Feb 2013
    Link to this post

    [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?

  2. Mark
    Mark avatar
    147 posts
    Registered:
    01 Jun 2010
    13 Feb 2013 in reply to Connections Academy Developer
    Link to this post

    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.

  3. gregory hernandez
    gregory hernandez avatar
    59 posts
    Registered:
    10 Jul 2009
    13 Feb 2013
    Link to this post

    +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.

  4. Amanda Shafer
    Amanda Shafer avatar
    198 posts
    Registered:
    12 Oct 2012
    14 Feb 2013
    Link to this post

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

  5. Connections Academy Developer
    Connections Academy Developer avatar
    151 posts
    Registered:
    04 May 2005
    19 Feb 2013
    Link to this post

    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.

  6. Connections Academy Developer
    Connections Academy Developer avatar
    151 posts
    Registered:
    04 May 2005
    21 Feb 2013
    Link to this post

    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. 
    Answered
  7. Boyan Barnev
    Boyan Barnev avatar
    1429 posts
    Registered:
    30 Oct 2017
    22 Feb 2013
    Link to this post
    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
7 posts, 1 answered