Knowledge Base: Database Configuration

Devver can run test suites that require a MySQL, Postgres, or SQLite database. In order to run your tests against the correct database, Devver automatically detects your database settings. For a regular Rails project, no additional configuration is necessary.

Detecting Database Settings

To determine whether we need to configure a database for your project, we look for two items (relative to the root directory for your project). If either of these items is missing, we assume your test suite does not need a database.

  1. A db directory
  2. A config/database.yml file. This file must contain an entry for a 'test' database with a 'adapter' key to specify which database to use (either mysql, postgresql, or sqlite3).

An entry in a config/database.yml file might look something like this:

test:
  adapter: mysql
  database: example_test
  username: example_dev
  password:
  host: localhost

Database Initialization

By default, we create your test database on our servers by running rake RAILS_ENV=test db:schema:load. Learn how to customize the database initialization step.

Migrations

Every time we detect a new or modified file in the db/migrate directory, we clear the database on our servers and re-initialize it from scratch, using the same steps listed above.