Phoenix: Drop SQLite from the list of supported databases

Created on 23 Dec 2018  路  4Comments  路  Source: phoenixframework/phoenix

Drop SQLite (and MongoDB) from the list of supported databases in guides/ecto.md.

Environment

  • Elixir version (elixir -v): 1.7.4
  • Phoenix version (mix deps): 1.4.0
  • NodeJS version (node -v): v6.15.1
  • NPM version (npm -v): 3.10.10
  • Operating system: Ubuntu 16.04.5 LTS

Expected behavior

Being able to use SQLite with Phoenix 1.4.

Actual behavior

Support for SQLite (and MongoDB) was removed in 2016 (see issue #1843 and commit 60351e6). Ecto 3 (see #3100 and commit 5e84b20) is the default database wrapper and the adapter for SQLite isn't compatible with Ecto 3 (see the Ecto documentation and elixir-sqlite/sqlite_ecto2#224) yet.

guides

Most helpful comment

Hello, I'm the maintainer of the SQLite adapter and can confirm it _does_ still work in Phoenix, but does not support Ecto 3 yet

All 4 comments

Phoenix 1.4 should work with Ecto 2, and elixir-sqlite/sqlite_ecto2 should work with Ecto 2.
Haven't personally tried, but nothing implies not being able to use it.
Perhaps a note to guides/ecto.md about version requirements, but in my opinion Ecto documentation is clear about that, and because guides/ecto.md doesn't point to any specific libraries, you should check out Ecto anyway.

Phoenix is not bound to Ecto 3 in any way, except through mix tasks that generate ecto-related code.
SQLite is not supported generator adapter, so you have to manually add libraries to mix.exs in which case you simply use Ecto 2.

I was able to compile Phoenix 1.4 using sqlite_ecto2 and Ecto 2.

Putting details here for anyone else trying to do the same:

I started by generating a new Phoenix Project using Postgresql. I then updated to use sqlite3 instead.

Firstly I followed instructions as per https://github.com/elixir-sqlite/sqlite_ecto2:

# In your config/config.exs file
config :my_app, Repo,
  adapter: Sqlite.Ecto2,
  database: "ecto_simple.sqlite3"

# In your application code
defmodule Repo do
  use Ecto.Repo,
    otp_app: :my_app,
    adapter: Sqlite.Ecto2
end

Lastly I managed to get it compiling using the following combination of dependencies:

defp deps do
  [
    {:phoenix, "~> 1.4.0"},
    {:phoenix_pubsub, "~> 1.1"},
    {:phoenix_ecto, "~> 3.2"},
    {:ecto, "~> 2.2.9"},
    {:sqlite_ecto2, "~> 2.2"},
    {:poison, "~> 3.1"},
    {:phoenix_html, "~> 2.11"},
    {:phoenix_live_reload, "~> 1.2", only: :dev},
    ...
]

I think we should get rid of MongoDB from the list and link to the official list here:

https://github.com/elixir-ecto/ecto#usage

Hello, I'm the maintainer of the SQLite adapter and can confirm it _does_ still work in Phoenix, but does not support Ecto 3 yet

Was this page helpful?
0 / 5 - 0 ratings