Copy Civi production data to development

From wiki.sir102.org
Jump to: navigation, search

The primary production website for branch membership data is sir102.org. However, a test/development site, dev.sir102.org, is also available for the development and testing of new features utilizing Civi components and membership data. Once a new feature has been tested it can then be safely installed on the production site. Often it is necessary or desirable to have the development Civi membership data mirror the production data, the following procedure outlines the steps to do this.

Log-in to the CiviHosting CPanel utility

  1. Using your web browser goto URL http://sir102.org/cp
  2. Enter appropriate username and password (Site webmaster can provide this information to you)
The website's control panel home page, containing many icon links, will be displayed

Export production Civi data

  1. Click on PhpMyAdmin.png icon to goto the page which provides, among other things, Import/Export support and will look something like
    PhpMyAdmin - Home Page.png
    The left-hand panel lists all databases associated with sir102 website.
  2. Click on the database named sir102_civicrm listed in the left-hand panel
    The right-hand side will now display a list of all the table is the selected database
    PhpMyAdmin - sir102 civicrm Table List.png
  3. Click Export from among the list of tabs displayed at the top of the page
    The new display will show Export method: with two options
  4. Click Custom - display all possible options and a display of all options will appear
    Leave all default options, i.e. those that are already checked, as-is - do not uncheck
  5. Scroll down to the Format-specific options: section
    PhpMyAdmin - Export - Format Specific Options.png
    1. Click/check the box labeled Disable foreign key checks
    2. Click/check the box labeled Add DROP TABLE / VIEW /PROCEDURE / FUNCTION / EVENT / TRIGGER statement located in the Object creation options subsection
    Scroll to the bottom of the page
  6. Click the Go button to begin the export of the selected database.
    A file named sir102_civicrm.sql will be created on you local computer in the download folder normally used by your browser
    A dialog box may appear asking whether you want the file to be saved or opened, choose save.
    This export and download process will typically take about 5 minutes or so to complete.

Compress exported .sql file

  1. Navigate to browser's download folder
  2. Right click sir102_civicrm.sql, the exported file, to show the file Options menu
  3. Click Compressed (zipped) folder from the Send To option
    A zip file sir102_civicrm.zip will be created in the same folder

Delete ALL Tables in sir102_dev_civicrm

  1. Click the Home icon at the top of the left-hand panel to refresh the display
  2. Click on the database named sir102_dev_civicrm in the left-hand panel
  3. Click Structure from among the list of tabs displayed at the top of the page if it is not already selected
  4. Repeat steps 4.1 to 4.4 as necessary until all tables are deleted, i.e. the Structure tab display is blank
    1. Click Check all by scrolling to the bottom of the Structure display
      PhpMyAdmin - sir102 dev civicrm Selected Table List.png
    2. Click With selected: drop-list to the right of the Check all option
    3. Click Drop from the Delete data or table option list and a display of the DROP TABLE sql is displayed PhpMyAdmin - Structure - Drop All Tables.png
    4. Scroll to the bottom of the page
      1. Click/uncheck Enable foreign key checks
      2. Click the Yes option to the question Do you really want to execute the following query?

Import production data

  1. Click Import from among the list of tabs displayed at the top of the page
  2. Click the Browse button in the File to import: section
    1. Navigate to the location where the compressed download sir102_civicrm.zip of sir102_civicrm was saved
    2. Select the zip file by single clicking it
    3. Click Open button at bottom of form
  3. Click Go at the bottom of the page
    The import process typically takes about 10 minutes to complete
    Sometimes the process generates a false error - Gateway Timeout, however click the Structure tab and all the tables are likely there.

Log-out

  1. Click the Exit in the phpMyAdmin left panel