diff --git a/.gitignore b/.gitignore index d96e1ac..1c3647c 100644 --- a/.gitignore +++ b/.gitignore @@ -27,3 +27,5 @@ erl_crash.dump tags tmp + +.idea diff --git a/.tool-versions b/.tool-versions index 7920c28..944495e 100644 --- a/.tool-versions +++ b/.tool-versions @@ -1 +1 @@ -elixir 1.6.6 +elixir 1.7 diff --git a/.travis.yml b/.travis.yml index 21f40af..dc4eb27 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,11 +1,13 @@ language: elixir elixir: - - 1.6.6 + - '1.7' otp_release: - - '20.0' + - '21.0' addons: postgresql: '9.4' - mysql: '5.6' + +services: + - mysql install: - mix local.rebar --force diff --git a/CHANGELOG.md b/CHANGELOG.md index d1748e8..434dab2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,11 @@ # Changelog +### MyXQL Support + +- I created a support for myxql package and mariaex package was removed, +to use this update you will need to add the myxql package e.g `{:myxql, "~> 0.3.0"}` +in your `mix.exs` file. + ## 1.3.0 ### Bug fixes diff --git a/docker-compose.yml b/docker-compose.yml index 0c6f562..59e787c 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -2,7 +2,7 @@ version: '3' services: mysql: - image: mariadb:latest + image: mysql:latest environment: - MYSQL_ALLOW_EMPTY_PASSWORD=yes - MYSQL_ROOT_PASSWORD= diff --git a/lib/mix/tasks/triplex.mysql.install.ex b/lib/mix/tasks/triplex.mysql.install.ex index 5ae0727..1aa0a02 100644 --- a/lib/mix/tasks/triplex.mysql.install.ex +++ b/lib/mix/tasks/triplex.mysql.install.ex @@ -8,8 +8,8 @@ defmodule Mix.Tasks.Triplex.Mysql.Install do require Mix.Generator + alias Ecto.Adapters.MyXQL alias Ecto.Migrator - alias Ecto.Adapters.MySQL alias Mix.Ecto alias Mix.Generator alias Mix.Project @@ -26,7 +26,7 @@ defmodule Mix.Tasks.Triplex.Mysql.Install do Enum.each(repos, fn repo -> Ecto.ensure_repo(repo, args) - if repo.__adapter__ != MySQL do + if repo.__adapter__ != MyXQL do Mix.raise("the tenant table only makes sense for MySQL repositories") end diff --git a/lib/triplex.ex b/lib/triplex.ex index a010c09..bc132b2 100644 --- a/lib/triplex.ex +++ b/lib/triplex.ex @@ -149,7 +149,7 @@ defmodule Triplex do else sql = case repo.__adapter__ do - Ecto.Adapters.MySQL -> "CREATE DATABASE #{to_prefix(tenant)}" + Ecto.Adapters.MyXQL -> "CREATE DATABASE #{to_prefix(tenant)}" Ecto.Adapters.Postgres -> "CREATE SCHEMA \"#{to_prefix(tenant)}\"" end @@ -180,7 +180,7 @@ defmodule Triplex do defp add_to_tenants_table(tenant, repo) do case repo.__adapter__ do - Ecto.Adapters.MySQL -> + Ecto.Adapters.MyXQL -> sql = "INSERT INTO #{Triplex.config().tenant_table} (name) VALUES (?)" SQL.query(repo, sql, [tenant]) @@ -191,7 +191,7 @@ defmodule Triplex do defp remove_from_tenants_table(tenant, repo) do case repo.__adapter__ do - Ecto.Adapters.MySQL -> + Ecto.Adapters.MyXQL -> SQL.query(repo, "DELETE FROM #{Triplex.config().tenant_table} WHERE NAME = ?", [tenant]) Ecto.Adapters.Postgres -> @@ -223,7 +223,7 @@ defmodule Triplex do else sql = case repo.__adapter__ do - Ecto.Adapters.MySQL -> "DROP DATABASE #{to_prefix(tenant)}" + Ecto.Adapters.MyXQL -> "DROP DATABASE #{to_prefix(tenant)}" Ecto.Adapters.Postgres -> "DROP SCHEMA \"#{to_prefix(tenant)}\" CASCADE" end @@ -250,7 +250,7 @@ defmodule Triplex do {:error, reserved_message(new_tenant)} else case repo.__adapter__ do - Ecto.Adapters.MySQL -> + Ecto.Adapters.MyXQL -> {:error, "you cannot rename tenants in a MySQL database."} Ecto.Adapters.Postgres -> @@ -276,7 +276,7 @@ defmodule Triplex do def all(repo \\ config().repo) do sql = case repo.__adapter__ do - Ecto.Adapters.MySQL -> + Ecto.Adapters.MyXQL -> "SELECT name FROM #{config().tenant_table}" Ecto.Adapters.Postgres -> @@ -304,7 +304,7 @@ defmodule Triplex do else sql = case repo.__adapter__ do - Ecto.Adapters.MySQL -> + Ecto.Adapters.MyXQL -> "SELECT COUNT(*) FROM #{config().tenant_table} WHERE name = ?" Ecto.Adapters.Postgres -> diff --git a/mix.exs b/mix.exs index 7413a55..cbfb488 100644 --- a/mix.exs +++ b/mix.exs @@ -5,7 +5,7 @@ defmodule Triplex.Mixfile do [ app: :triplex, version: "1.3.0", - elixir: "~> 1.6", + elixir: "~> 1.7", description: "Build multitenant applications on top of Ecto.", package: package(), elixirc_paths: elixirc_paths(Mix.env()), @@ -48,12 +48,14 @@ defmodule Triplex.Mixfile do defp deps do [ {:credo, "~> 0.8.10", only: [:test, :dev], optional: true, runtime: false}, - {:ecto_sql, "~> 3.0"}, + {:ecto_sql, "~> 3.4"}, {:ex_doc, "~> 0.18.0", only: :dev}, {:excoveralls, "~> 0.10", only: :test}, {:inch_ex, ">= 0.0.0", only: :docs}, - {:mariaex, "~> 0.9.0", optional: true}, - {:postgrex, ">= 0.14.0", optional: true} + {:plug, "~> 1.6", optional: true}, + {:postgrex, ">= 0.15.0", optional: true}, + {:myxql, ">= 0.3.0", optional: true}, + {:decimal, ">= 1.6.0"} ] end diff --git a/mix.lock b/mix.lock index f760f03..96411a9 100644 --- a/mix.lock +++ b/mix.lock @@ -1,32 +1,159 @@ %{ - "bunt": {:hex, :bunt, "0.2.0", "951c6e801e8b1d2cbe58ebbd3e616a869061ddadcc4863d0a2182541acae9a38", [:mix], [], "hexpm"}, - "certifi": {:hex, :certifi, "2.4.2", "75424ff0f3baaccfd34b1214184b6ef616d89e420b258bb0a5ea7d7bc628f7f0", [:rebar3], [{:parse_trans, "~>3.3", [hex: :parse_trans, optional: false]}]}, - "connection": {:hex, :connection, "1.0.4", "a1cae72211f0eef17705aaededacac3eb30e6625b04a6117c1b2db6ace7d5976", [:mix], []}, - "credo": {:hex, :credo, "0.8.10", "261862bb7363247762e1063713bb85df2bbd84af8d8610d1272cd9c1943bba63", [:mix], [{:bunt, "~> 0.2.0", [hex: :bunt, repo: "hexpm", optional: false]}], "hexpm"}, - "db_connection": {:hex, :db_connection, "2.0.1", "09454c6c6e8e4295f400b72580b19f0ac68fda2602e209533285206cb99bee6b", [:mix], [{:connection, "~> 1.0.2", [hex: :connection, optional: false]}]}, - "decimal": {:hex, :decimal, "1.5.0", "b0433a36d0e2430e3d50291b1c65f53c37d56f83665b43d79963684865beab68", [:mix], []}, - "earmark": {:hex, :earmark, "1.3.1", "73812f447f7a42358d3ba79283cfa3075a7580a3a2ed457616d6517ac3738cb9", [:mix], [], "hexpm"}, - "ecto": {:hex, :ecto, "3.0.1", "a26605ee7b243a754e6609d1c23da27bcb22823659b07bf03f9020da92a8e4f4", [:mix], [{:decimal, "~> 1.5", [hex: :decimal, optional: false]}, {:jason, "~> 1.0", [hex: :jason, optional: true]}, {:poison, "~> 2.2 or ~> 3.0", [hex: :poison, optional: true]}]}, - "ecto_sql": {:hex, :ecto_sql, "3.0.0", "8d1883376bee02a0e76b5ef797e39d04333c34b9935d0b4785dbf3cbdb571e2a", [:mix], [{:db_connection, "~> 2.0", [hex: :db_connection, optional: false]}, {:ecto, "~> 3.0.0", [hex: :ecto, optional: false]}, {:mariaex, "~> 0.9.0", [hex: :mariaex, optional: true]}, {:postgrex, "~> 0.14.0", [hex: :postgrex, optional: true]}, {:telemetry, "~> 0.2.0", [hex: :telemetry, optional: false]}]}, - "ex_doc": {:hex, :ex_doc, "0.18.4", "4406b8891cecf1352f49975c6d554e62e4341ceb41b9338949077b0d4a97b949", [:mix], [{:earmark, "~> 1.1", [hex: :earmark, repo: "hexpm", optional: false]}], "hexpm"}, - "excoveralls": {:hex, :excoveralls, "0.10.2", "fb4abd5b8a1b9d52d35e1162e7e2ea8bfb84b47ae07c38d39aa8ce64be0b0794", [:mix], [{:hackney, "~> 1.13", [hex: :hackney, optional: false]}, {:jason, "~> 1.0", [hex: :jason, optional: false]}]}, - "hackney": {:hex, :hackney, "1.14.3", "b5f6f5dcc4f1fba340762738759209e21914516df6be440d85772542d4a5e412", [:rebar3], [{:certifi, "2.4.2", [hex: :certifi, optional: false]}, {:idna, "6.0.0", [hex: :idna, optional: false]}, {:metrics, "1.0.1", [hex: :metrics, optional: false]}, {:mimerl, "1.0.2", [hex: :mimerl, optional: false]}, {:ssl_verify_fun, "1.1.4", [hex: :ssl_verify_fun, optional: false]}]}, - "idna": {:hex, :idna, "6.0.0", "689c46cbcdf3524c44d5f3dde8001f364cd7608a99556d8fbd8239a5798d4c10", [:rebar3], [{:unicode_util_compat, "0.4.1", [hex: :unicode_util_compat, optional: false]}]}, - "inch_ex": {:hex, :inch_ex, "1.0.1", "1f0af1a83cec8e56f6fc91738a09c838e858db3d78ef5f2ec040fe4d5a62dabf", [:mix], [{:poison, "~> 1.5 or ~> 2.0 or ~> 3.0", [hex: :poison, optional: false]}]}, - "jason": {:hex, :jason, "1.1.2", "b03dedea67a99223a2eaf9f1264ce37154564de899fd3d8b9a21b1a6fd64afe7", [:mix], [{:decimal, "~> 1.0", [hex: :decimal, optional: true]}]}, - "makeup": {:hex, :makeup, "0.5.5", "9e08dfc45280c5684d771ad58159f718a7b5788596099bdfb0284597d368a882", [:mix], [{:nimble_parsec, "~> 0.4", [hex: :nimble_parsec, optional: false]}]}, - "makeup_elixir": {:hex, :makeup_elixir, "0.10.0", "0f09c2ddf352887a956d84f8f7e702111122ca32fbbc84c2f0569b8b65cbf7fa", [:mix], [{:makeup, "~> 0.5.5", [hex: :makeup, optional: false]}]}, - "mariaex": {:hex, :mariaex, "0.9.0", "efae33e21f1aa08af64060e48179eaf781c3f62fa4f1e6efba8418ef22bad794", [:mix], [{:db_connection, "~> 2.0", [hex: :db_connection, optional: false]}, {:decimal, "~> 1.2", [hex: :decimal, optional: false]}, {:poison, ">= 0.0.0", [hex: :poison, optional: true]}]}, - "metrics": {:hex, :metrics, "1.0.1", "25f094dea2cda98213cecc3aeff09e940299d950904393b2a29d191c346a8486", [:rebar3], []}, - "mime": {:hex, :mime, "1.3.0", "5e8d45a39e95c650900d03f897fbf99ae04f60ab1daa4a34c7a20a5151b7a5fe", [:mix], []}, - "mimerl": {:hex, :mimerl, "1.0.2", "993f9b0e084083405ed8252b99460c4f0563e41729ab42d9074fd5e52439be88", [:rebar3], []}, - "nimble_parsec": {:hex, :nimble_parsec, "0.4.0", "ee261bb53214943679422be70f1658fff573c5d0b0a1ecd0f18738944f818efe", [:mix], []}, - "parse_trans": {:hex, :parse_trans, "3.3.0", "09765507a3c7590a784615cfd421d101aec25098d50b89d7aa1d66646bc571c1", [:rebar3], []}, - "plug": {:hex, :plug, "1.7.1", "8516d565fb84a6a8b2ca722e74e2cd25ca0fc9d64f364ec9dbec09d33eb78ccd", [:mix], [{:mime, "~> 1.0", [hex: :mime, optional: false]}, {:plug_crypto, "~> 1.0", [hex: :plug_crypto, optional: false]}]}, - "plug_crypto": {:hex, :plug_crypto, "1.0.0", "18e49317d3fa343f24620ed22795ec29d4a5e602d52d1513ccea0b07d8ea7d4d", [:mix], []}, - "poison": {:hex, :poison, "3.1.0", "d9eb636610e096f86f25d9a46f35a9facac35609a7591b3be3326e99a0484665", [:mix], []}, - "postgrex": {:hex, :postgrex, "0.14.0", "f3d6ffea1ca8a156e0633900a5338a3d17b00435227726baed8982718232b694", [:mix], [{:connection, "~> 1.0", [hex: :connection, optional: false]}, {:db_connection, "~> 2.0", [hex: :db_connection, optional: false]}, {:decimal, "~> 1.0", [hex: :decimal, optional: false]}, {:jason, "~> 1.0", [hex: :jason, optional: true]}]}, - "ssl_verify_fun": {:hex, :ssl_verify_fun, "1.1.4", "f0eafff810d2041e93f915ef59899c923f4568f4585904d010387ed74988e77b", [:make, :mix, :rebar3], []}, - "telemetry": {:hex, :telemetry, "0.2.0", "5b40caa3efe4deb30fb12d7cd8ed4f556f6d6bd15c374c2366772161311ce377", [:mix], []}, - "unicode_util_compat": {:hex, :unicode_util_compat, "0.4.1", "d869e4c68901dd9531385bb0c8c40444ebf624e60b6962d95952775cac5e90cd", [:rebar3], []}, + bunt: + {:hex, :bunt, "0.2.0", "951c6e801e8b1d2cbe58ebbd3e616a869061ddadcc4863d0a2182541acae9a38", + [:mix], [], "hexpm", "7af5c7e09fe1d40f76c8e4f9dd2be7cebd83909f31fee7cd0e9eadc567da8353"}, + certifi: + {:hex, :certifi, "2.4.2", "75424ff0f3baaccfd34b1214184b6ef616d89e420b258bb0a5ea7d7bc628f7f0", + [:rebar3], [{:parse_trans, "~>3.3", [hex: :parse_trans, repo: "hexpm", optional: false]}], + "hexpm", "01d479edba0569a7b7a2c8bf923feeb6dc6a358edc2965ef69aea9ba288bb243"}, + connection: + {:hex, :connection, "1.0.4", + "a1cae72211f0eef17705aaededacac3eb30e6625b04a6117c1b2db6ace7d5976", [:mix], [], "hexpm", + "4a0850c9be22a43af9920a71ab17c051f5f7d45c209e40269a1938832510e4d9"}, + credo: + {:hex, :credo, "0.8.10", "261862bb7363247762e1063713bb85df2bbd84af8d8610d1272cd9c1943bba63", + [:mix], [{:bunt, "~> 0.2.0", [hex: :bunt, repo: "hexpm", optional: false]}], "hexpm", + "f3fe29f8de6be431c7736a933a3897fe9aa45533b1d1358b3691ac8ec4371e8f"}, + db_connection: + {:hex, :db_connection, "2.2.2", + "3bbca41b199e1598245b716248964926303b5d4609ff065125ce98bcd368939e", [:mix], + [{:connection, "~> 1.0.2", [hex: :connection, repo: "hexpm", optional: false]}], "hexpm", + "642af240d8a8affb93b4ba5a6fcd2bbcbdc327e1a524b825d383711536f8070c"}, + decimal: + {:hex, :decimal, "1.8.1", "a4ef3f5f3428bdbc0d35374029ffcf4ede8533536fa79896dd450168d9acdf3c", + [:mix], [], "hexpm", "3cb154b00225ac687f6cbd4acc4b7960027c757a5152b369923ead9ddbca7aec"}, + earmark: + {:hex, :earmark, "1.3.1", "73812f447f7a42358d3ba79283cfa3075a7580a3a2ed457616d6517ac3738cb9", + [:mix], [], "hexpm", "000aaeff08919e95e7aea13e4af7b2b9734577b3e6a7c50ee31ee88cab6ec4fb"}, + ecto: + {:hex, :ecto, "3.4.5", "2bcd262f57b2c888b0bd7f7a28c8a48aa11dc1a2c6a858e45dd8f8426d504265", + [:mix], + [ + {:decimal, "~> 1.6 or ~> 2.0", [hex: :decimal, repo: "hexpm", optional: false]}, + {:jason, "~> 1.0", [hex: :jason, repo: "hexpm", optional: true]}, + {:telemetry, "~> 0.4", [hex: :telemetry, repo: "hexpm", optional: false]} + ], "hexpm", "8c6d1d4d524559e9b7a062f0498e2c206122552d63eacff0a6567ffe7a8e8691"}, + ecto_sql: + {:hex, :ecto_sql, "3.4.4", "d28bac2d420f708993baed522054870086fd45016a9d09bb2cd521b9c48d32ea", + [:mix], + [ + {:db_connection, "~> 2.2", [hex: :db_connection, repo: "hexpm", optional: false]}, + {:ecto, "~> 3.4.3", [hex: :ecto, repo: "hexpm", optional: false]}, + {:myxql, "~> 0.3.0 or ~> 0.4.0", [hex: :myxql, repo: "hexpm", optional: true]}, + {:postgrex, "~> 0.15.0", [hex: :postgrex, repo: "hexpm", optional: true]}, + {:tds, "~> 2.1.0", [hex: :tds, repo: "hexpm", optional: true]}, + {:telemetry, "~> 0.4.0", [hex: :telemetry, repo: "hexpm", optional: false]} + ], "hexpm", "edb49af715dd72f213b66adfd0f668a43c17ed510b5d9ac7528569b23af57fe8"}, + ex_doc: + {:hex, :ex_doc, "0.18.4", "4406b8891cecf1352f49975c6d554e62e4341ceb41b9338949077b0d4a97b949", + [:mix], [{:earmark, "~> 1.1", [hex: :earmark, repo: "hexpm", optional: false]}], "hexpm", + "9dbe1ce1d711dc5362e3b3280e92989ad61413ce423bc4e9f76d5fcc51ab8d6b"}, + excoveralls: + {:hex, :excoveralls, "0.10.2", + "fb4abd5b8a1b9d52d35e1162e7e2ea8bfb84b47ae07c38d39aa8ce64be0b0794", [:mix], + [ + {:hackney, "~> 1.13", [hex: :hackney, repo: "hexpm", optional: false]}, + {:jason, "~> 1.0", [hex: :jason, repo: "hexpm", optional: false]} + ], "hexpm", "20c5ca8d5431a0e0ba4060cd48f2c0d63de5aa51646aed041c47453fb06ce956"}, + hackney: + {:hex, :hackney, "1.14.3", "b5f6f5dcc4f1fba340762738759209e21914516df6be440d85772542d4a5e412", + [:rebar3], + [ + {:certifi, "2.4.2", [hex: :certifi, repo: "hexpm", optional: false]}, + {:idna, "6.0.0", [hex: :idna, repo: "hexpm", optional: false]}, + {:metrics, "1.0.1", [hex: :metrics, repo: "hexpm", optional: false]}, + {:mimerl, "1.0.2", [hex: :mimerl, repo: "hexpm", optional: false]}, + {:ssl_verify_fun, "1.1.4", [hex: :ssl_verify_fun, repo: "hexpm", optional: false]} + ], "hexpm", "ed15491f324aa0e95647dca8ef4340418dac479d1204d57e455d52dcfba3f705"}, + idna: + {:hex, :idna, "6.0.0", "689c46cbcdf3524c44d5f3dde8001f364cd7608a99556d8fbd8239a5798d4c10", + [:rebar3], + [ + {:unicode_util_compat, "0.4.1", + [hex: :unicode_util_compat, repo: "hexpm", optional: false]} + ], "hexpm", "4bdd305eb64e18b0273864920695cb18d7a2021f31a11b9c5fbcd9a253f936e2"}, + inch_ex: + {:hex, :inch_ex, "1.0.1", "1f0af1a83cec8e56f6fc91738a09c838e858db3d78ef5f2ec040fe4d5a62dabf", + [:mix], + [{:poison, "~> 1.5 or ~> 2.0 or ~> 3.0", [hex: :poison, repo: "hexpm", optional: false]}], + "hexpm", "08fd8a9205d3e1aefad9d7cb2a7f6b346e4a3e6ff09e139f6ec978f3a479ba14"}, + jason: + {:hex, :jason, "1.2.1", "12b22825e22f468c02eb3e4b9985f3d0cb8dc40b9bd704730efa11abd2708c44", + [:mix], [{:decimal, "~> 1.0", [hex: :decimal, repo: "hexpm", optional: true]}], "hexpm", + "b659b8571deedf60f79c5a608e15414085fa141344e2716fbd6988a084b5f993"}, + makeup: + {:hex, :makeup, "0.5.5", "9e08dfc45280c5684d771ad58159f718a7b5788596099bdfb0284597d368a882", + [:mix], [{:nimble_parsec, "~> 0.4", [hex: :nimble_parsec, optional: false]}]}, + makeup_elixir: + {:hex, :makeup_elixir, "0.10.0", + "0f09c2ddf352887a956d84f8f7e702111122ca32fbbc84c2f0569b8b65cbf7fa", [:mix], + [{:makeup, "~> 0.5.5", [hex: :makeup, optional: false]}]}, + mariaex: + {:hex, :mariaex, "0.9.1", "83266fec657ea68dd426f4bbc12594be45ee91fe162ebf1bf017ce3cfa098ddd", + [:mix], + [ + {:db_connection, "~> 2.0", [hex: :db_connection, repo: "hexpm", optional: false]}, + {:decimal, "~> 1.2", [hex: :decimal, repo: "hexpm", optional: false]}, + {:poison, ">= 0.0.0", [hex: :poison, repo: "hexpm", optional: true]} + ], "hexpm", "b09f7b1a4eccde9829d8eeaab7126e9c7bd652398df6fd2c2334436e92fdec62"}, + metrics: + {:hex, :metrics, "1.0.1", "25f094dea2cda98213cecc3aeff09e940299d950904393b2a29d191c346a8486", + [:rebar3], [], "hexpm", "69b09adddc4f74a40716ae54d140f93beb0fb8978d8636eaded0c31b6f099f16"}, + mime: + {:hex, :mime, "1.3.0", "5e8d45a39e95c650900d03f897fbf99ae04f60ab1daa4a34c7a20a5151b7a5fe", + [:mix], [], "hexpm", "5e839994289d60326aa86020c4fbd9c6938af188ecddab2579f07b66cd665328"}, + mimerl: + {:hex, :mimerl, "1.0.2", "993f9b0e084083405ed8252b99460c4f0563e41729ab42d9074fd5e52439be88", + [:rebar3], [], "hexpm", "7a4c8e1115a2732a67d7624e28cf6c9f30c66711a9e92928e745c255887ba465"}, + myxql: + {:hex, :myxql, "0.3.4", "41163cfc97b899db0fd9ebb6f38a8dc841298a7fa1c1e84a93b9369e2dbb1815", + [:mix], + [ + {:db_connection, "~> 2.0", [hex: :db_connection, repo: "hexpm", optional: false]}, + {:decimal, "~> 1.6", [hex: :decimal, repo: "hexpm", optional: false]}, + {:geo, "~> 3.3", [hex: :geo, repo: "hexpm", optional: true]}, + {:jason, "~> 1.0", [hex: :jason, repo: "hexpm", optional: true]} + ], "hexpm", "fc8d49ba141a46a174b410e7c86906d4d655ff8a1e1608c31d5d1777d106d1dd"}, + nimble_parsec: + {:hex, :nimble_parsec, "0.4.0", + "ee261bb53214943679422be70f1658fff573c5d0b0a1ecd0f18738944f818efe", [:mix], []}, + parse_trans: + {:hex, :parse_trans, "3.3.0", + "09765507a3c7590a784615cfd421d101aec25098d50b89d7aa1d66646bc571c1", [:rebar3], [], "hexpm", + "17ef63abde837ad30680ea7f857dd9e7ced9476cdd7b0394432af4bfc241b960"}, + plug: + {:hex, :plug, "1.7.1", "8516d565fb84a6a8b2ca722e74e2cd25ca0fc9d64f364ec9dbec09d33eb78ccd", + [:mix], + [ + {:mime, "~> 1.0", [hex: :mime, repo: "hexpm", optional: false]}, + {:plug_crypto, "~> 1.0", [hex: :plug_crypto, repo: "hexpm", optional: false]} + ], "hexpm", "daa5fee4209c12c3c48b05a96cf88c320b627c9575f987554dcdc1fdcdf2c15e"}, + plug_crypto: + {:hex, :plug_crypto, "1.0.0", + "18e49317d3fa343f24620ed22795ec29d4a5e602d52d1513ccea0b07d8ea7d4d", [:mix], [], "hexpm", + "73c1682f0e414cfb5d9b95c8e8cd6ffcfdae699e3b05e1db744e58b7be857759"}, + poison: + {:hex, :poison, "3.1.0", "d9eb636610e096f86f25d9a46f35a9facac35609a7591b3be3326e99a0484665", + [:mix], [], "hexpm", "fec8660eb7733ee4117b85f55799fd3833eb769a6df71ccf8903e8dc5447cfce"}, + postgrex: + {:hex, :postgrex, "0.15.5", + "aec40306a622d459b01bff890fa42f1430dac61593b122754144ad9033a2152f", [:mix], + [ + {:connection, "~> 1.0", [hex: :connection, repo: "hexpm", optional: false]}, + {:db_connection, "~> 2.1", [hex: :db_connection, repo: "hexpm", optional: false]}, + {:decimal, "~> 1.5", [hex: :decimal, repo: "hexpm", optional: false]}, + {:jason, "~> 1.0", [hex: :jason, repo: "hexpm", optional: true]} + ], "hexpm", "ed90c81e1525f65a2ba2279dbcebf030d6d13328daa2f8088b9661eb9143af7f"}, + ssl_verify_fun: + {:hex, :ssl_verify_fun, "1.1.4", + "f0eafff810d2041e93f915ef59899c923f4568f4585904d010387ed74988e77b", [:make, :mix, :rebar3], + [], "hexpm", "603561dc0fd62f4f2ea9b890f4e20e1a0d388746d6e20557cafb1b16950de88c"}, + telemetry: + {:hex, :telemetry, "0.4.2", + "2808c992455e08d6177322f14d3bdb6b625fbcfd233a73505870d8738a2f4599", [:rebar3], [], "hexpm", + "2d1419bd9dda6a206d7b5852179511722e2b18812310d304620c7bd92a13fcef"}, + unicode_util_compat: + {:hex, :unicode_util_compat, "0.4.1", + "d869e4c68901dd9531385bb0c8c40444ebf624e60b6962d95952775cac5e90cd", [:rebar3], [], "hexpm", + "1d1848c40487cdb0b30e8ed975e34e025860c02e419cb615d255849f3427439d"} } diff --git a/test/mix/tasks/triplex.mysql.install_test.exs b/test/mix/tasks/triplex.mysql.install_test.exs index 9c120f2..98e9db6 100644 --- a/test/mix/tasks/triplex.mysql.install_test.exs +++ b/test/mix/tasks/triplex.mysql.install_test.exs @@ -10,7 +10,7 @@ defmodule Mix.Tasks.Triplex.Mysql.InstallTest do defmodule MySQLRepo do def __adapter__ do - Ecto.Adapters.MySQL + Ecto.Adapters.MyXQL end def config do diff --git a/test/support/ms_test_repo.ex b/test/support/ms_test_repo.ex index c2fca51..4e78dc0 100644 --- a/test/support/ms_test_repo.ex +++ b/test/support/ms_test_repo.ex @@ -1,3 +1,3 @@ defmodule Triplex.MSTestRepo do - use Ecto.Repo, otp_app: :triplex, adapter: Ecto.Adapters.MySQL + use Ecto.Repo, otp_app: :triplex, adapter: Ecto.Adapters.MyXQL end diff --git a/test/triplex/triplex_test.exs b/test/triplex/triplex_test.exs index 9d37ae8..d96f824 100644 --- a/test/triplex/triplex_test.exs +++ b/test/triplex/triplex_test.exs @@ -42,7 +42,7 @@ defmodule TriplexTest do assert {:ok, _} = Triplex.create("lala", MSTestRepo) - assert {:error, "(1007): Can't create database 'lala'; database exists"} = + assert {:error, "(1007) (ER_DB_CREATE_EXISTS) Can't create database 'lala'; database exists"} = Triplex.create("lala", MSTestRepo) end @@ -170,7 +170,7 @@ defmodule TriplexTest do defp assert_notes_table_is_dropped(repo) do error = case repo.__adapter__() do - Ecto.Adapters.MySQL -> Mariaex.Error + Ecto.Adapters.MyXQL -> MyXQL.Error Ecto.Adapters.Postgres -> Postgrex.Error end @@ -203,7 +203,7 @@ defmodule TriplexTest do defp force_migration_failure(repo, migration_function) do sql = case repo.__adapter__ do - Ecto.Adapters.MySQL -> + Ecto.Adapters.MyXQL -> """ DELETE FROM #{@tenant}.schema_migrations """ @@ -216,8 +216,8 @@ defmodule TriplexTest do {:ok, _} = Ecto.Adapters.SQL.query(repo, sql, []) - if repo.__adapter__ == Ecto.Adapters.MySQL do - migration_function.("(1050): Table 'notes' already exists") + if repo.__adapter__ == Ecto.Adapters.MyXQL do + migration_function.("(1050) (ER_TABLE_EXISTS_ERROR) Table 'notes' already exists") else migration_function.("ERROR 42P07 (duplicate_table) relation \"notes\" already exists") end