Forum

Thread tagged as: Question, Runway

Importing hundreds of pages in to a collection

Hi Drew/Rachael

I am upgrading a site from Perch to Runway but the site has roughly 900 pages now. They are all built from a handful of master pages and it makes sense to put the data in to collections as it's accessed from all over the site.

I imported 230 pages in to one collection and although it was very smooth, it took ages because I was importing one page at a time. I am now looking at another tree in the sitemap and there is about 450 pages to it, but all from the same master page.

So easy question really, is there a way to import loads of pages all at the same time or do I just have a really late night?! Even if I run a sql query direct on the database, it would be worth it but may also give me way more issues...

Cheers!

Michael Wilkinson

Michael Wilkinson 6 points

  • 5 years ago
Drew McLellan

Drew McLellan 2638 points
Perch Support

It could be possible to reassign all the items to one region in the database, and then import that one region.

If you need to do it tonight then I don't really have a solution, but if it's not urgent I could look into it tomorrow. How comfortable are you working with a RDBMS?

Michael Wilkinson

Michael Wilkinson 6 points
Registered Developer

Hi Drew

Not urgent for tonight as you've probably worked out!

Your thoughts of reassigning sounds good in theory. I'm very comfortable working with the database so happy to get my hands dirty.

Drew McLellan

Drew McLellan 2638 points
Perch Support

The first thing to do is pick a page and region to be the 'master' for this operation - the one you'll attach all the others to. You need to go to the perch2_content_regions table and choose your region. Note its pageID, regionID and regionRev.

Next you need to update the perch2_content_items table. Set the pageID, regionID and regionRev to match that of the master region, where the current regionID is one of the regions you're looking for (by joining back to the perch2_content_regions table).

Make good backups first, because you might find yourself needing to do this over a few times before it's right.

Michael Wilkinson

Michael Wilkinson 6 points
Registered Developer

Hi Drew

That makes perfect sense, thank you so much. Will get on that.

I wrote a series of update SQL statements to convert all the pages from local files to their relevant master pages and updating the regions along the way so they point to the new bits as well. It meant I converted roughly 850 pages from local files to pointing at their relevant master pages in about 5 minutes. Saved me days! So happy it's on Runway now and felt worryingly good to delete sooooooo many files.

I'm now pretty familiar with the database so hopefully the collections upgrade will be just as successful.

Thanks again.