Skip to content

darinwilson/music_db_workshop

Repository files navigation

MusicDB

A playground for experimenting with Ecto.

Installation

Prerequisites

  • Elixir >= 1.5 (1.9 recommended)
  • PostgreSQL >= 9.0 (MySQL or SQLite may work - see "Other Databases" below)

Database Configuration

By default, the app will attempt to connect to the database using your system username and an empty password. If your database needs different credentials, you'll need to set up the following environment variables:

export DATABASE_USERNAME=[your username]
export DATABASE_PASSWORD=[your password]

Setup

Clone the repo, then run:

bin/setup

This will check for Elixir, load dependencies, setup the database, and run a few smoke tests to verify that the app is communicating with the database.

If all goes well, you'll see this at the end:

Setup complete - everything looks good! 👍

Other Databases

This is app has been tested with PostgreSQL, but other databases supported by Ecto may work. If you want to use a different database, you'll need to:

  1. Add the database driver as a dependency in the deps function in mix.exs
  2. Change the adapter setting in lib/music_db/repo.ex

See the Ecto README for a list of supported adapters and driver dependencies.

Data Model

This app sets up four schemas: Artist, Album, Track, and Genre. To help keep things simple, they're fairly stripped down, and have a minimal configuration. See the corresponding modules for details.

As you might expect, Artist has_many Albums, which has_many Tracks. Albums has a many_to_many relationship with Genres.

data model

About

A playground for experimenting with Ecto

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published