Skip to content

Git hook to create multiple DBs and settings.php files for each branch

License

Notifications You must be signed in to change notification settings

matrixlord/Drupal-7-branch-environment

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 

Repository files navigation

Drupal 7, branch environment

This is a script that runs as a git hook after a branch checkout.

It is specific for Drupal 7 and its main use is to create a different DBs and settings.php files for each branch.

###Details:

  • It uses post-checkout hook
  • It creates a different DB for each branch on checkout
  • It creates a backup of settings.php file for every branch, in the format settings_${branchName}.php
  • The DB is copied from the "master" DB

###Use case:

  • Before anything, be sure to have checked out the master branch of your project
  • Set the original DB of your Drupal 7 project as {prefix}master, where prefix is the name of your project. e.g. my_new_eshop_master. In this case the "my_new_eshop_" is the prefix
  • Copy "post-checkout" file into ".git/hooks/" folder in your Drupal 7 project
  • Change inside the file "dbPrefix" variable to your DB prefix e.g. "my_new_eshop_"
  • Make post-checkout file executable: chmod +x post-checkout
  • Set in "post-checkout" file the root username and password, dbUser and dbPass respectively
  • Set in "post-checkout" file the user that is connected to the DB from Drupal in "dbUserAccess". This is the DB user that Drupal uses to connect to the DB

Sponsored by Human Factor

About

Git hook to create multiple DBs and settings.php files for each branch

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages