MssqlEcto

Build Status Coverage Status Inline docs Ebert Hex.pm LICENSE

Ecto Adapter for Mssqlex

Installation

Erlang ODBC Application

MssqlEcto requires the Erlang ODBC application to be installed. This might require the installation of an additional package depending on how you have installed Elixir/Erlang (e.g. on Ubuntu sudo apt-get install erlang-odbc).

Microsoft’s ODBC Driver

MssqlEcto depends on Microsoft’s ODBC Driver for SQL Server. You can find installation instructions for Linux or other platforms on the official site.

Hex

This package is availabe in Hex, the package can be installed by adding mssql_ecto to your list of dependencies in mix.exs:

def deps do
  [{:mssql_ecto, "~> 0.1"}]
end

If you are running an Elixir version below 1.4 or you have the applcations key set in your application options, you will also need to update your list of running applications:

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

Configuration

Example configuration:

config :my_app, MyApp.Repo,
  adapter: MssqlEcto,
  database: "sql_server_db",
  username: "bob",
  password: "mySecurePa$$word",
  hostname: "localhost"

Type Mappings

Ecto TypeSQL Server TypeCaveats
:idint
:serialint identity(1, 1)
:binary_idchar(36)
:uuidchar(36)
:stringnvarchar
:binarynvarchar(4000)Limited size, not fully implemented
:integerint
:booleanbit
{:array, type}list of typeNot Supported
:mapnvarchar(4000)Not Supported
{:map, _}nvarchar(4000)Not Supported
:datedate
:timetimeCan write but can’t read
:utc_datetimedatetime2
:naive_datetimedatetime2
:floatfloat
:decimaldecimal

Features not yet implemented

  • Table comments
  • Column comments
  • On conflict
  • Upserts