Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Chris Houston 535 posts 980 karma points MVP admin c-trib
    Nov 26, 2009 @ 10:59
    Chris Houston
    0

    How to copy documents using SQL from a Umbraco 3 to Umbraco 4 DB?

    Hi All,

    I have a client site currently live running Umbraco 3.0.5

    I have upgraded this site on our development server (to Umbraco 4.0.2.1) and have added additional functionality, so what we intend to do is a complete swap for the old site files / db to the new site files / db.

    Although I asked the client not to add more content... of course.. they have added a LOT of new pages since we took the original backup and so the content of the development site is now completely out of sync.

    I have taken a backup of the live SQL DB today and have restored it on our development server, so in theory I should be able to write SQL scripts to copy the new documents from the old DB to the new version 4 DB. (The pages are all based on one type of "document type" and it has not changed)

    So my question was has anyone done this, and if so can you post the SQL required?

    And if not.. can someone let me know the best way to go about this?

    Thanks in advance!

    Cheers,

    Chris

    P.s. If no one knows the answer, I will post my solution when I've worked it out.. as one way or another.. I need to get this done today :)

     

  • Thomas Höhler 1237 posts 1709 karma points MVP
    Nov 26, 2009 @ 11:17
    Thomas Höhler
    1

    If you have both versions running you can write two webservices (one for the old version one for the new one) and a console app which gets the content from the old version and puts it up to the new version. So you don't have to struggle with the database. For an example you can see my session from codegarden this year: http://our.umbraco.org/wiki/codegarden-2009/codegarden09-sessions/the-box/using-webservices-in-umbraco

    hth, Thomas

  • Chris Houston 535 posts 980 karma points MVP admin c-trib
    Nov 26, 2009 @ 11:19
    Chris Houston
    0

    Hi Thomas,

    Thanks for the quick reply, yes, I did consider writing a web service for this as I have just created one for this site for importing data, but, as I have both the DB's on the same server, it must be possible ( and a lot quicker ) to copy the data from one to the other using SQL?

    Cheers,

    Chris

  • Thomas Höhler 1237 posts 1709 karma points MVP
    Nov 26, 2009 @ 11:25
    Thomas Höhler
    0

    But it is much more unsafe. Use the API for creating the data and not own sql even if you think that you know the structure of the database. eg. you have to create two versions for each document.

    Cheers, Thomas

  • Lee Kelleher 4024 posts 15833 karma points MVP 13x admin c-trib
    Nov 26, 2009 @ 11:26
    Lee Kelleher
    2

    Hi Chris,

    Another idea to throw into the pot...

    Recreate the live Umbraco v3 site on your dev environment ... upgrade it to v4 ... then export the content as a package - and importing into the new v4 site?

    I've never actually tried that... but in theory it "should" work.  Make back-ups beforehand, just in case anything goes wrong.

    Good luck! Lee.

  • Chris Houston 535 posts 980 karma points MVP admin c-trib
    Nov 26, 2009 @ 14:16
    Chris Houston
    1

    Hi Thomas / Lee,

    Thanks for your suggestions, both would of course have worked.

    In the end I decided to give Lee's idea a go, this is what I did:

    • Made a copy of the current dev website and created a new IIS site
    • Pointed this site to the a copy of the current live V3 database
    • Re-ran the upgrade script
    • Re-published everything
    • Spotted a couple of things I forgot I had changed on the live site  i.e. additional doctype parameters!
    • Created a package of the live nodes I needed
    • Deleted the dev site nodes I intended to replace
    • Deleted all items in the recycle bin ( just incase the node ID's interferred )
    • Installed the package ( first couple of times it failed due to missing parameters on the doc types, see above)

    And now.. it's all working :)

    Which has saved me a lot of manual fixing!

    Cheers,

    Chris

Please Sign in or register to post replies

Write your reply to:

Draft