Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #251 from mzelenyuk/add-postgresql-setup-instructions
Add instructions to setup PostgreSQL
- Loading branch information
Showing
2 changed files
with
42 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
--- | ||
title: Guides - Database Configuration | ||
--- | ||
|
||
# Database Configuration | ||
|
||
Before starting your server, you need to configure the database link in <code>.env*</code> files. | ||
|
||
Open this file for each environment and update <code>DATABASE_URL</code> for your database. | ||
|
||
## <a href="http://www.postgresql.org/" target="_blank">PostgreSQL</a> | ||
|
||
Setup database variable for the development environment: | ||
|
||
``` | ||
# .env.development | ||
DATABASE_URL="postgresql://username:password@localhost/bookshelf_development" | ||
``` | ||
|
||
Setup database variable for the test environment: | ||
|
||
``` | ||
# .env.test | ||
DATABASE_URL="postgresql://username:password@localhost/bookshelf_test" | ||
``` | ||
|
||
# Setup your database | ||
|
||
After your database variables setup is done you need to create the database and run the migrations before being able to launch a development server. | ||
|
||
In your terminal, enter: | ||
|
||
``` | ||
% bundle exec hanami db prepare | ||
``` | ||
|
||
To setup your test environment database, enter: | ||
|
||
``` | ||
% HANAMI_ENV=test bundle exec hanami db prepare | ||
``` |