diff --git a/config/config.exs b/config/config.exs index 303a99f..3d99564 100644 --- a/config/config.exs +++ b/config/config.exs @@ -7,9 +7,6 @@ # General application configuration use Mix.Config -config :planningpoker, - ecto_repos: [Planningpoker.Repo] - # Configures the endpoint config :planningpoker, PlanningpokerWeb.Endpoint, url: [host: "localhost"], diff --git a/config/dev.exs b/config/dev.exs index 07bd9fa..02b4e1c 100644 --- a/config/dev.exs +++ b/config/dev.exs @@ -1,14 +1,5 @@ use Mix.Config -# Configure your database -config :planningpoker, Planningpoker.Repo, - username: "postgres", - password: "postgres", - database: "planningpoker_dev", - hostname: "localhost", - show_sensitive_data_on_connection_error: true, - pool_size: 10 - # For development, we disable any cache and enable # debugging and code reloading. # diff --git a/config/prod.secret.exs b/config/prod.secret.exs index e92518f..f72eb73 100644 --- a/config/prod.secret.exs +++ b/config/prod.secret.exs @@ -4,18 +4,6 @@ # remember to add this file to your .gitignore. use Mix.Config -database_url = - System.get_env("DATABASE_URL") || - raise """ - environment variable DATABASE_URL is missing. - For example: ecto://USER:PASS@HOST/DATABASE - """ - -config :planningpoker, Planningpoker.Repo, - # ssl: true, - url: database_url, - pool_size: String.to_integer(System.get_env("POOL_SIZE") || "10") - secret_key_base = System.get_env("SECRET_KEY_BASE") || raise """ diff --git a/config/test.exs b/config/test.exs index b61b651..b7a859e 100644 --- a/config/test.exs +++ b/config/test.exs @@ -1,17 +1,5 @@ use Mix.Config -# Configure your database -# -# The MIX_TEST_PARTITION environment variable can be used -# to provide built-in test partitioning in CI environment. -# Run `mix help test` for more information. -config :planningpoker, Planningpoker.Repo, - username: "postgres", - password: "postgres", - database: "planningpoker_test#{System.get_env("MIX_TEST_PARTITION")}", - hostname: "localhost", - pool: Ecto.Adapters.SQL.Sandbox - # We don't run a server during test. If one is required, # you can enable the server option below. config :planningpoker, PlanningpokerWeb.Endpoint, diff --git a/lib/planningpoker/application.ex b/lib/planningpoker/application.ex index 2808459..a188d17 100644 --- a/lib/planningpoker/application.ex +++ b/lib/planningpoker/application.ex @@ -7,8 +7,6 @@ defmodule Planningpoker.Application do def start(_type, _args) do children = [ - # Start the Ecto repository - Planningpoker.Repo, # Start the Telemetry supervisor PlanningpokerWeb.Telemetry, # Start the PubSub system diff --git a/lib/planningpoker/repo.ex b/lib/planningpoker/repo.ex deleted file mode 100644 index db9c51b..0000000 --- a/lib/planningpoker/repo.ex +++ /dev/null @@ -1,5 +0,0 @@ -defmodule Planningpoker.Repo do - use Ecto.Repo, - otp_app: :planningpoker, - adapter: Ecto.Adapters.Postgres -end diff --git a/lib/planningpoker_web/endpoint.ex b/lib/planningpoker_web/endpoint.ex index 545de61..1ad09d3 100644 --- a/lib/planningpoker_web/endpoint.ex +++ b/lib/planningpoker_web/endpoint.ex @@ -32,7 +32,6 @@ defmodule PlanningpokerWeb.Endpoint do socket "/phoenix/live_reload/socket", Phoenix.LiveReloader.Socket plug Phoenix.LiveReloader plug Phoenix.CodeReloader - plug Phoenix.Ecto.CheckRepoStatus, otp_app: :planningpoker end plug Phoenix.LiveDashboard.RequestLogger, diff --git a/lib/planningpoker_web/telemetry.ex b/lib/planningpoker_web/telemetry.ex index 8602c3a..ba3ad0f 100644 --- a/lib/planningpoker_web/telemetry.ex +++ b/lib/planningpoker_web/telemetry.ex @@ -28,13 +28,6 @@ defmodule PlanningpokerWeb.Telemetry do unit: {:native, :millisecond} ), - # Database Metrics - summary("planningpoker.repo.query.total_time", unit: {:native, :millisecond}), - summary("planningpoker.repo.query.decode_time", unit: {:native, :millisecond}), - summary("planningpoker.repo.query.query_time", unit: {:native, :millisecond}), - summary("planningpoker.repo.query.queue_time", unit: {:native, :millisecond}), - summary("planningpoker.repo.query.idle_time", unit: {:native, :millisecond}), - # VM Metrics summary("vm.memory.total", unit: {:byte, :kilobyte}), summary("vm.total_run_queue_lengths.total"), diff --git a/mix.exs b/mix.exs index 62c2d31..c118b61 100644 --- a/mix.exs +++ b/mix.exs @@ -34,9 +34,6 @@ defmodule Planningpoker.MixProject do defp deps do [ {:phoenix, "~> 1.5.1"}, - {:phoenix_ecto, "~> 4.1"}, - {:ecto_sql, "~> 3.4"}, - {:postgrex, ">= 0.0.0"}, {:phoenix_html, "~> 2.11"}, {:phoenix_live_reload, "~> 1.2", only: :dev}, {:phoenix_live_dashboard, "~> 0.2.0"}, @@ -56,10 +53,7 @@ defmodule Planningpoker.MixProject do # See the documentation for `Mix` for more info on aliases. defp aliases do [ - setup: ["deps.get", "ecto.setup", "cmd npm install --prefix assets"], - "ecto.setup": ["ecto.create", "ecto.migrate", "run priv/repo/seeds.exs"], - "ecto.reset": ["ecto.drop", "ecto.setup"], - test: ["ecto.create --quiet", "ecto.migrate", "test"] + setup: ["deps.get", "cmd npm install --prefix assets"] ] end end diff --git a/priv/gettext/en/LC_MESSAGES/errors.po b/priv/gettext/en/LC_MESSAGES/errors.po index a589998..cdec3a1 100644 --- a/priv/gettext/en/LC_MESSAGES/errors.po +++ b/priv/gettext/en/LC_MESSAGES/errors.po @@ -9,89 +9,3 @@ msgid "" msgstr "" "Language: en\n" - -## From Ecto.Changeset.cast/4 -msgid "can't be blank" -msgstr "" - -## From Ecto.Changeset.unique_constraint/3 -msgid "has already been taken" -msgstr "" - -## From Ecto.Changeset.put_change/3 -msgid "is invalid" -msgstr "" - -## From Ecto.Changeset.validate_acceptance/3 -msgid "must be accepted" -msgstr "" - -## From Ecto.Changeset.validate_format/3 -msgid "has invalid format" -msgstr "" - -## From Ecto.Changeset.validate_subset/3 -msgid "has an invalid entry" -msgstr "" - -## From Ecto.Changeset.validate_exclusion/3 -msgid "is reserved" -msgstr "" - -## From Ecto.Changeset.validate_confirmation/3 -msgid "does not match confirmation" -msgstr "" - -## From Ecto.Changeset.no_assoc_constraint/3 -msgid "is still associated with this entry" -msgstr "" - -msgid "are still associated with this entry" -msgstr "" - -## From Ecto.Changeset.validate_length/3 -msgid "should be %{count} character(s)" -msgid_plural "should be %{count} character(s)" -msgstr[0] "" -msgstr[1] "" - -msgid "should have %{count} item(s)" -msgid_plural "should have %{count} item(s)" -msgstr[0] "" -msgstr[1] "" - -msgid "should be at least %{count} character(s)" -msgid_plural "should be at least %{count} character(s)" -msgstr[0] "" -msgstr[1] "" - -msgid "should have at least %{count} item(s)" -msgid_plural "should have at least %{count} item(s)" -msgstr[0] "" -msgstr[1] "" - -msgid "should be at most %{count} character(s)" -msgid_plural "should be at most %{count} character(s)" -msgstr[0] "" -msgstr[1] "" - -msgid "should have at most %{count} item(s)" -msgid_plural "should have at most %{count} item(s)" -msgstr[0] "" -msgstr[1] "" - -## From Ecto.Changeset.validate_number/3 -msgid "must be less than %{number}" -msgstr "" - -msgid "must be greater than %{number}" -msgstr "" - -msgid "must be less than or equal to %{number}" -msgstr "" - -msgid "must be greater than or equal to %{number}" -msgstr "" - -msgid "must be equal to %{number}" -msgstr "" diff --git a/priv/gettext/errors.pot b/priv/gettext/errors.pot index 39a220b..d6f47fa 100644 --- a/priv/gettext/errors.pot +++ b/priv/gettext/errors.pot @@ -8,88 +8,3 @@ ## date. Leave `msgstr`s empty as changing them here has no ## effect: edit them in PO (`.po`) files instead. -## From Ecto.Changeset.cast/4 -msgid "can't be blank" -msgstr "" - -## From Ecto.Changeset.unique_constraint/3 -msgid "has already been taken" -msgstr "" - -## From Ecto.Changeset.put_change/3 -msgid "is invalid" -msgstr "" - -## From Ecto.Changeset.validate_acceptance/3 -msgid "must be accepted" -msgstr "" - -## From Ecto.Changeset.validate_format/3 -msgid "has invalid format" -msgstr "" - -## From Ecto.Changeset.validate_subset/3 -msgid "has an invalid entry" -msgstr "" - -## From Ecto.Changeset.validate_exclusion/3 -msgid "is reserved" -msgstr "" - -## From Ecto.Changeset.validate_confirmation/3 -msgid "does not match confirmation" -msgstr "" - -## From Ecto.Changeset.no_assoc_constraint/3 -msgid "is still associated with this entry" -msgstr "" - -msgid "are still associated with this entry" -msgstr "" - -## From Ecto.Changeset.validate_length/3 -msgid "should be %{count} character(s)" -msgid_plural "should be %{count} character(s)" -msgstr[0] "" -msgstr[1] "" - -msgid "should have %{count} item(s)" -msgid_plural "should have %{count} item(s)" -msgstr[0] "" -msgstr[1] "" - -msgid "should be at least %{count} character(s)" -msgid_plural "should be at least %{count} character(s)" -msgstr[0] "" -msgstr[1] "" - -msgid "should have at least %{count} item(s)" -msgid_plural "should have at least %{count} item(s)" -msgstr[0] "" -msgstr[1] "" - -msgid "should be at most %{count} character(s)" -msgid_plural "should be at most %{count} character(s)" -msgstr[0] "" -msgstr[1] "" - -msgid "should have at most %{count} item(s)" -msgid_plural "should have at most %{count} item(s)" -msgstr[0] "" -msgstr[1] "" - -## From Ecto.Changeset.validate_number/3 -msgid "must be less than %{number}" -msgstr "" - -msgid "must be greater than %{number}" -msgstr "" - -msgid "must be less than or equal to %{number}" -msgstr "" - -msgid "must be greater than or equal to %{number}" -msgstr "" - -msgid "must be equal to %{number}" -msgstr "" diff --git a/priv/repo/migrations/.formatter.exs b/priv/repo/migrations/.formatter.exs deleted file mode 100644 index 49f9151..0000000 --- a/priv/repo/migrations/.formatter.exs +++ /dev/null @@ -1,4 +0,0 @@ -[ - import_deps: [:ecto_sql], - inputs: ["*.exs"] -] diff --git a/priv/repo/seeds.exs b/priv/repo/seeds.exs deleted file mode 100644 index 38fb856..0000000 --- a/priv/repo/seeds.exs +++ /dev/null @@ -1,11 +0,0 @@ -# Script for populating the database. You can run it as: -# -# mix run priv/repo/seeds.exs -# -# Inside the script, you can read and write to any of your -# repositories directly: -# -# Planningpoker.Repo.insert!(%Planningpoker.SomeSchema{}) -# -# We recommend using the bang functions (`insert!`, `update!` -# and so on) as they will fail if something goes wrong. diff --git a/test/support/channel_case.ex b/test/support/channel_case.ex index f7b689f..4c9013f 100644 --- a/test/support/channel_case.ex +++ b/test/support/channel_case.ex @@ -28,13 +28,7 @@ defmodule PlanningpokerWeb.ChannelCase do end end - setup tags do - :ok = Ecto.Adapters.SQL.Sandbox.checkout(Planningpoker.Repo) - - unless tags[:async] do - Ecto.Adapters.SQL.Sandbox.mode(Planningpoker.Repo, {:shared, self()}) - end - + setup _tags do :ok end end diff --git a/test/support/conn_case.ex b/test/support/conn_case.ex index f9942a3..ac1ae29 100644 --- a/test/support/conn_case.ex +++ b/test/support/conn_case.ex @@ -31,13 +31,7 @@ defmodule PlanningpokerWeb.ConnCase do end end - setup tags do - :ok = Ecto.Adapters.SQL.Sandbox.checkout(Planningpoker.Repo) - - unless tags[:async] do - Ecto.Adapters.SQL.Sandbox.mode(Planningpoker.Repo, {:shared, self()}) - end - + setup _tags do {:ok, conn: Phoenix.ConnTest.build_conn()} end end diff --git a/test/support/data_case.ex b/test/support/data_case.ex deleted file mode 100644 index 83f3e2b..0000000 --- a/test/support/data_case.ex +++ /dev/null @@ -1,55 +0,0 @@ -defmodule Planningpoker.DataCase do - @moduledoc """ - This module defines the setup for tests requiring - access to the application's data layer. - - You may define functions here to be used as helpers in - your tests. - - Finally, if the test case interacts with the database, - we enable the SQL sandbox, so changes done to the database - are reverted at the end of every test. If you are using - PostgreSQL, you can even run database tests asynchronously - by setting `use Planningpoker.DataCase, async: true`, although - this option is not recommended for other databases. - """ - - use ExUnit.CaseTemplate - - using do - quote do - alias Planningpoker.Repo - - import Ecto - import Ecto.Changeset - import Ecto.Query - import Planningpoker.DataCase - end - end - - setup tags do - :ok = Ecto.Adapters.SQL.Sandbox.checkout(Planningpoker.Repo) - - unless tags[:async] do - Ecto.Adapters.SQL.Sandbox.mode(Planningpoker.Repo, {:shared, self()}) - end - - :ok - end - - @doc """ - A helper that transforms changeset errors into a map of messages. - - assert {:error, changeset} = Accounts.create_user(%{password: "short"}) - assert "password is too short" in errors_on(changeset).password - assert %{password: ["password is too short"]} = errors_on(changeset) - - """ - def errors_on(changeset) do - Ecto.Changeset.traverse_errors(changeset, fn {message, opts} -> - Regex.replace(~r"%{(\w+)}", message, fn _, key -> - opts |> Keyword.get(String.to_existing_atom(key), key) |> to_string() - end) - end) - end -end diff --git a/test/test_helper.exs b/test/test_helper.exs index 522047a..869559e 100644 --- a/test/test_helper.exs +++ b/test/test_helper.exs @@ -1,2 +1 @@ ExUnit.start() -Ecto.Adapters.SQL.Sandbox.mode(Planningpoker.Repo, :manual)