Create database snapshots

The demonstration site module is a great tool if you want to create a public Drupal demo site. You can set it up to import a fresh database each hour. Let me explain how I use it.

To get started just go to http://drupal.org/project/demo and download the module, then place it in sites/all/modules.

Then enable the module at Administer >> Site building >> Modules.

Go to Administer >> Site building >> Demonstration site to checkout the module.

demo_fig1.jpg

Creating a snapshot is easy, just click on the Create snapshot tab, fill in the name and a description then hit Create.

demo_fig2.jpg

To reset a site to a previous snapshot just click on the Reset site tab, select the snapshot you want to use and click on Reset.

demo_fig3.jpg

Let me now explain how I use this module within my development workflow. The first thing I do is change the Dump path to somewhere outside of the files directory.

This way if you use a version control system (git, svn, cvs) you'll be able to add it to your repository when you commit changes.

Just a word of warning don't copy over the snapshots onto your production server when deploying a website. User could download the sql dump file if they know the direct URL.

If you have any questions leave a commit. I would also be interested to hear how you handle database files between developers when working on a website together.

Comments

Anonymous's picture

A very good tutorial. Thanks for sharing this!

Post new comment

The content of this field is kept private and will not be shown publicly. If you have a Gravatar account, used to display your avatar.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Allowed HTML tags: <a> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd> <img> <pre> <h2> <h3>
  • Lines and paragraphs break automatically.
  • You can enable syntax highlighting of source code with the following tags: <code>, <blockcode>. Beside the tag style "<foo>" it is also possible to use "[foo]". PHP source code can also be enclosed in <?php ... ?> or <% ... %>.

More information about formatting options