How to export a database schema for version control

Description

Collection: Change Management and Version ControlChapter: How to Version Control the Database

Transcript

Now we're going to export our database in two parts. The first part is going to be the schema, and then the second part is going to be the data; and like we discussed before, the data might not be something that you want to keep around in the long term, but it can be useful at the beginning of your project for development purposes. I'm going to jump to the command line.

When it comes to exporting the schema, we want to make sure that we're exporting from our production site and not from a development site. Now, the process of getting that export into version control might be a little bit tricky because on the production site we are running the master version and we don't want to switch to a different branch; otherwise, our file system will change. Also, if we're using the Gitflow method, we're not going to be making commits like this to the master branch.

So what we'll need to is export our schema, then download the schema and then add it into our develop branch. If we were working with a production site on a remote server, what we'd probably do is use ftp to download it, or we could create a remote repository on our production server that's outside of the web root so it's not accessible and switch over to the develop branch there and add it in directly in our production environment. For this video series, since we are doing everything locally including our production site, then all I'm going to do is copy and paste it in, but just keep in mind that in the real world, you'll probably use ftp or the clone of the Git repository on your production site.

So I'm on the production command line and we want to make sure that we're outside of the web root because we are going to be exporting our database and we don't want it to be available even for a s ...

In this series we uncover how to use powerful tools to speed up and stabilize the Drupal development process. We begin with a thorough walk-through of Git, the version control system. After we cover how to patch modules and upgrade Drupal from one minor version to another, we demonstrate how to use the Features module to version control components of Drupal that aren't typically available to version control. Finally, we wrap up with how to integrate Drush - a powerful command line tool for Drupal - into your workflow to speed up the process of doing everything we discussed earlier in the series.

Some of the key points we'll be covering include:

How to use the command line

How to work with the Features module to capture important database changes and make deployment easier.

How to use Git for version control

Best practices for working on a Drupal team

Who this collection is for

This video collection is mainly for developers who want to improve their deployment strategies and learn how to work on a shared Drupal code base with other developers. However, even if you are not a developer, our coverage of using Features and version control is extremely valuable for deploying Drupal sites and sharing reusable components between projects.

Prerequisites

Even if you are not a developer, you will be able to follow with most of this collection. When we talk about code we do not go into detail about the basic components of the code, so you may want to brush up on some coding basics in the "PHP Programming Basics" collection.

It looks like there might be an issue playing videos in this browser. We're working on better cross-brower experience, but in the meantime please try the latest Chrome or Firefox browsers. Or, you may be able to watch the video directly without progress tracking or transcript: