Skip to content

Instantly share code, notes, and snippets.

@neerajsingh0101
Last active September 1, 2020 10:57
Show Gist options
  • Save neerajsingh0101/fa7096b327519aa3028a4045c52bee62 to your computer and use it in GitHub Desktop.
Save neerajsingh0101/fa7096b327519aa3028a4045c52bee62 to your computer and use it in GitHub Desktop.
<% branch_name = `git symbolic-ref HEAD 2>/dev/null`.chomp.sub('refs/heads/', '') %>
<% repository_name = `git rev-parse --show-toplevel`.split('/').last.strip %>
# Check https://gist.github.com/neerajdotname/b9d53f8a234da9d8c007de5e3d98bc21 to see
# details about the restriction on database name
# If you prefer to have branch name in the database name then use following
# database: <%= "#{repository_name}_development_#{branch_name}"[0...63] %>
development:
adapter: postgresql
database: <%= "#{repository_name}_development"[0...63] %>
host: localhost
pool: 5
test:
adapter: postgresql
database: <%= "#{repository_name}_test"[0...63] %>
host: localhost
pool: 5
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment