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 :)
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
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?
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.
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.
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 :)
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
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
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
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.
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:
And now.. it's all working :)
Which has saved me a lot of manual fixing!
Cheers,
Chris
is working on a reply...