Skip to content

Basic Sqlite.Ecto Tutorial

Jason M Barnes edited this page May 20, 2015 · 26 revisions

Introduction

Sqlite.Ecto is an Ecto adapter which helps you to interact with SQLite databases. This very brief tutorial will walk you through the basics of configuring and using Ecto with SQLite. We are going to setup a very basic schema that one might need for a blog. The following assumes you already have some familiarity with Elixir development.

PLEASE NOTE that the following schema is in no way secure and should not be used for a production database. It is only being used to demonstrate some features of Ecto.

Configuring Ecto

Let's create our new Elixir code with mix: mix new blog. Change into the new directory and update the mix.exs file to use Ecto and SQLite:

def application do
  [applications: [:logger, :sqlite_ecto, :ecto]]
end

defp deps do
  [{:sqlite_ecto, "~> 0.0.2"}]
end
Clone this wiki locally