MssqlEcto

Build Status Coverage Status Inline docs Hex.pm LICENSE

Ecto Adapter for Mssqlex

WARNING! Testing In Progress

Please note, that we are still developing and testing this adapter and have not yet got it running in production.

We are currently only testing using Elixir on Linux.

If you find any issues with the software please report them using the GitHub Issue Tracker.

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

SQL Server version compatibility

  • [x] SQL Server 2016
  • [ ] SQL Server 2014
  • [ ] SQL Server 2012
  • [ ] SQL Server 2008

Features not yet implemented

  • Table comments
  • Column comments
  • On conflict
  • Constraint checking