-
Notifications
You must be signed in to change notification settings - Fork 171
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Create Database configuration Guide page
- Loading branch information
Showing
2 changed files
with
43 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,40 @@ | ||
--- | ||
title: Guides - Database Configuration Overview | ||
--- | ||
|
||
# Overview | ||
|
||
Before starting your server, you need to configure 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="postgres://username:password@localhost/bookshelf_development" | ||
``` | ||
|
||
Setup database variable for the test environment: | ||
|
||
``` | ||
# .env.test | ||
DATABASE_URL="postgres://username:password@localhost/bookshelf_test" | ||
``` | ||
|
||
## Prepare tables in database | ||
|
||
After your database variables setup is done you need to create a table in your database before you're be able to launch a development server. | ||
In your terminal, enter: | ||
|
||
``` | ||
% bundle exec hanami db prepare | ||
``` | ||
|
||
To create a table in database for the test environment, enter: | ||
|
||
``` | ||
% HANAMI_ENV=test bundle exec hanami db prepare | ||
``` |