Skip to content

Commit

Permalink
Merge pull request #251 from mzelenyuk/add-postgresql-setup-instructions
Browse files Browse the repository at this point in the history
Add instructions to setup PostgreSQL
  • Loading branch information
AlfonsoUceda committed Jan 30, 2017
2 parents 41cf226 + 3f46d70 commit 82e7303
Show file tree
Hide file tree
Showing 2 changed files with 42 additions and 0 deletions.
1 change: 1 addition & 0 deletions data/guides.yml
Expand Up @@ -52,6 +52,7 @@ categories:
- path: models
pages:
- path: overview
- path: database-configuration
- path: repositories
- path: entities
- path: data-types
Expand Down
41 changes: 41 additions & 0 deletions source/guides/models/database-configuration.md
@@ -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
```

0 comments on commit 82e7303

Please sign in to comment.