Skip to content

Commit

Permalink
Create Database configuration Guide page
Browse files Browse the repository at this point in the history
  • Loading branch information
mzeleniuk committed Dec 19, 2016
1 parent 519bc4a commit 8e6911a
Show file tree
Hide file tree
Showing 2 changed files with 43 additions and 0 deletions.
3 changes: 3 additions & 0 deletions data/guides.yml
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,9 @@ categories:
- path: associations
- path: use-your-own-orm
title: Use Your Own ORM
- path: database-configuration
pages:
- path: overview
- path: migrations
pages:
- path: overview
Expand Down
40 changes: 40 additions & 0 deletions source/guides/database-configuration/overview.md
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
```

0 comments on commit 8e6911a

Please sign in to comment.