MssqlEcto
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 Type | SQL Server Type | Caveats |
---|---|---|
:id | int | |
:serial | int identity(1, 1) | |
:binary_id | char(36) | |
:uuid | char(36) | |
:string | nvarchar | |
:binary | nvarchar(4000) | Limited size, not fully implemented |
:integer | int | |
:boolean | bit | |
{:array, type} | list of type | Not Supported |
:map | nvarchar(4000) | Not Supported |
{:map, _} | nvarchar(4000) | Not Supported |
:date | date | |
:time | time | Can write but can’t read |
:utc_datetime | datetime2 | |
:naive_datetime | datetime2 | |
:float | float | |
:decimal | decimal |
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