Forum

Thread tagged as: Question

Local database/live database

I'm going to add a blog to an existing live Perch site and also at the same time update Perch to the latest version. I'll carry this out on a local copy of the site first. In the time it will take to do this my client may wish to edit the live site or visitors may fill out a form on the site.

My question is, when I've finished working locally what is the best way to bring the local database together with the live database?

I've read https://forum.grabaperch.com/forum/02-07-2016-recommended-method-for-updating-a-live-site-with-new-contentassetsregions. Not sure if similar?

Louise Shearer

Louise Shearer 0 points

  • 5 years ago
Drew McLellan

Drew McLellan 2638 points
Perch Support

You shouldn't need to worry about the database, as Perch will automatically create the new database tables when you deploy the files and go to the Blog app in the control panel.

Simon Clay

Simon Clay 127 points

Hi Louise, I hit this question many times myself. Bringing local development back to the live site is a challenge not unique to Perch. Thankfully, I think with Perch it's about as easy as it can be.

I find each situation is different and needs a slightly different approach. Here are my thoughts on how I think I'd do things in your circumstance. I hope it's helpful. (I'm sure there are other ways, I'd be really interested to hear thoughts from others).

Firstly to say, when the local work is done, there is not a need to upload the local database back to the live site.

It looks like quite a long list, but the general gist is: avoid the temptation to enter lot's of content locally. Do that on the live site, after you've uploaded the files and templates you developed locally. This way, you avoid the complicated task of merging two databases.

Update Perch Core (locally and live)

  • Download the live site files and database and get the site up and running locally.
  • Update Perch Core locally according to the instructions and check the site is working ok after the update.
  • Update Perch Core to the live site according to the instructions and check the site is working ok after the update. (I would do this now, rather than later, to keep things simple and easy to test).

Develop Blog locally

  • Install Blog locally.
  • Set up your Blog pages and templates.
  • Add a few test posts.
  • Adjust your Blog pages and templates until you're happy.
  • Adjust any other existing pages, that you'd like to show Blog listing on (e.g. Homepage featured blog listing). Keep a note of these pages as we will be uploading them separately

Initial upload to live site

  • Upload the Blog App to the live site according to the instructions
  • Upload your Blog section and templates

Add real Blog posts

  • In Admin, go to Blog and add any proper blog posts.
  • View the live Blog pages to check they look as intended

Upload remaining files

  • Upload and check any other pages that show blog listing (e.g. Homepage featured blog listing).

Other things to consider:

  • Nav: make sure Blog is hidden from nav until you're done.
  • Perform this on a staging site first, to be extra sure

Thanks for your replies Drew and Simon.

Simon – your advice on how to tackle this is super helpful, thank you. Originally I thought I'd enter initial content locally, but the above makes so much more sense now. Will let you know how I get on.

Hi Simon, all went really smoothly following your very comprehensive steps, thank you!

Just in case this helps anyone else, the only thing I could perhaps add to the 'other things to consider' part of the list is, if you change any Perch blog settings or add categories, to remember you'll need to repeat this for staging and live.

Simon Clay

Simon Clay 127 points

That's great to hear Louise. Thank you for letting us know. :)