From 1553384cecd42414ec9c22928d36b8499cb51524 Mon Sep 17 00:00:00 2001 From: Stu Page Date: Fri, 7 Mar 2025 11:59:36 -0600 Subject: [PATCH 1/5] updated the readme --- README.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index afdef18..52c0f2e 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@ -[![Build Status](https://travis-ci.org/revelrylabs/ecto_soft_delete.svg?branch=master)](https://travis-ci.org/revelrylabs/ecto_soft_delete) +![Build Status](https://github.com/revelrylabs/ecto_soft_delete/actions/workflows/test.yml/badge.svg) +![Publish Status](https://github.com/revelrylabs/ecto_soft_delete/actions/workflows/publish.yml/badge.svg) [![Hex.pm](https://img.shields.io/hexpm/dt/ecto_soft_delete.svg)](https://hex.pm/packages/ecto_soft_delete) [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT) -[![Coverage Status](https://opencov.prod.revelry.net/projects/21/badge.svg)](https://opencov.prod.revelry.net/projects/21) # EctoSoftDelete @@ -136,7 +136,7 @@ Add to mix.exs: ```elixir defp deps do - [{:ecto_soft_delete, "~> 2.0"}] + [{:ecto_soft_delete, "~> 2.0.5"}] end ``` From 69073cc25ca93e6cb7bd35b73b1ac63b2bff48c9 Mon Sep 17 00:00:00 2001 From: Stu Page Date: Fri, 7 Mar 2025 12:06:19 -0600 Subject: [PATCH 2/5] included formatting file; ran formatter --- .formatter.exs | 7 +++++++ .github/workflows/test.yml | 1 + config/config.exs | 2 +- lib/ecto/soft_delete_query.ex | 10 +++++----- test/soft_delete_migration_test.exs | 11 ++++++++--- test/test_helper.exs | 3 ++- 6 files changed, 24 insertions(+), 10 deletions(-) create mode 100644 .formatter.exs diff --git a/.formatter.exs b/.formatter.exs new file mode 100644 index 0000000..89fb624 --- /dev/null +++ b/.formatter.exs @@ -0,0 +1,7 @@ +[ + import_deps: [:ecto, :ecto_sql], + inputs: [ + "*.{ex,exs}", + "{config,lib,test}/**/*.{ex,exs}" + ] +] diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 44f22c9..c7ca9ca 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -48,3 +48,4 @@ jobs: cp config/test.exs.GH_actions config/test.exs mix ecto.create mix test + mix format --check-formatted diff --git a/config/config.exs b/config/config.exs index 3e030c2..bb265cd 100644 --- a/config/config.exs +++ b/config/config.exs @@ -27,4 +27,4 @@ import Config # Configuration from the imported file will override the ones defined # here (which is why it is important to import them last). # - import_config "#{Mix.env}.exs" +import_config "#{Mix.env()}.exs" diff --git a/lib/ecto/soft_delete_query.ex b/lib/ecto/soft_delete_query.ex index a6d52f2..f05b1f4 100644 --- a/lib/ecto/soft_delete_query.ex +++ b/lib/ecto/soft_delete_query.ex @@ -14,7 +14,7 @@ defmodule Ecto.SoftDelete.Query do results = Repo.all(query) """ - @spec with_undeleted(Ecto.Queryable.t) :: Ecto.Queryable.t + @spec with_undeleted(Ecto.Queryable.t()) :: Ecto.Queryable.t() def with_undeleted(query) do if soft_deletable?(query) do query @@ -31,7 +31,7 @@ defmodule Ecto.SoftDelete.Query do |> soft_deletable? """ - @spec soft_deletable?(Ecto.Queryable.t) :: boolean() + @spec soft_deletable?(Ecto.Queryable.t()) :: boolean() def soft_deletable?(query) do schema_module = get_schema_module(query) fields = if schema_module, do: schema_module.__schema__(:fields), else: [] @@ -39,14 +39,14 @@ defmodule Ecto.SoftDelete.Query do Enum.member?(fields, :deleted_at) end - @doc""" + @doc """ Returns `true` if the schema is not flagged to skip auto-filtering """ - @spec auto_include_deleted_at_clause?(Ecto.Queriable.t) :: boolean() + @spec auto_include_deleted_at_clause?(Ecto.Queriable.t()) :: boolean() def auto_include_deleted_at_clause?(query) do schema_module = get_schema_module(query) - !Kernel.function_exported?(schema_module, :skip_soft_delete_prepare_query?, 0) || + !Kernel.function_exported?(schema_module, :skip_soft_delete_prepare_query?, 0) || !schema_module.skip_soft_delete_prepare_query?() end diff --git a/test/soft_delete_migration_test.exs b/test/soft_delete_migration_test.exs index 7be3453..a01e72e 100644 --- a/test/soft_delete_migration_test.exs +++ b/test/soft_delete_migration_test.exs @@ -7,7 +7,13 @@ defmodule Ecto.SoftDelete.Migration.Test do setup meta do :ok = Ecto.Adapters.SQL.Sandbox.checkout(Repo) - {:ok, runner} = Runner.start_link({self(), Repo, Repo.config(), __MODULE__, meta[:direction] || :forward, :up, %{level: false, sql: false}}) + + {:ok, runner} = + Runner.start_link( + {self(), Repo, Repo.config(), __MODULE__, meta[:direction] || :forward, :up, + %{level: false, sql: false}} + ) + Runner.metadata(runner, meta) {:ok, runner: runner} end @@ -21,7 +27,6 @@ defmodule Ecto.SoftDelete.Migration.Test do flush() - assert {:create, _, - [{:add, :deleted_at, :utc_datetime_usec, []}]} = create_command + assert {:create, _, [{:add, :deleted_at, :utc_datetime_usec, []}]} = create_command end end diff --git a/test/test_helper.exs b/test/test_helper.exs index b1e8af0..04c1c52 100644 --- a/test/test_helper.exs +++ b/test/test_helper.exs @@ -1,5 +1,5 @@ {:ok, _} = Application.ensure_all_started(:postgrex) -{:ok, _pid} = Ecto.SoftDelete.Test.Repo.start_link +{:ok, _pid} = Ecto.SoftDelete.Test.Repo.start_link() defmodule Ecto.SoftDelete.Test.Migrations do use Ecto.Migration @@ -7,6 +7,7 @@ defmodule Ecto.SoftDelete.Test.Migrations do def change do drop_if_exists table(:users) + create table(:users) do add :email, :string soft_delete_columns() From c289971a00bcfcd6b6ce0988a39cfe0635a9d58b Mon Sep 17 00:00:00 2001 From: Stu Page Date: Fri, 7 Mar 2025 13:14:33 -0600 Subject: [PATCH 3/5] updated mix.exs --- mix.exs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/mix.exs b/mix.exs index 9b14203..a2290c8 100644 --- a/mix.exs +++ b/mix.exs @@ -4,7 +4,7 @@ defmodule EctoSoftDelete.Mixfile do def project do [ app: :ecto_soft_delete, - version: "2.0.4", + version: "2.0.5", elixir: "~> 1.11", elixirc_paths: elixirc_paths(Mix.env()), build_embedded: Mix.env() == :prod, @@ -48,7 +48,7 @@ defmodule EctoSoftDelete.Mixfile do defp package do [ files: ["lib", "mix.exs", "README.md", "LICENSE", "CHANGELOG.md"], - maintainers: ["Bryan Joseph", "Luke Ledet"], + maintainers: ["Bryan Joseph", "Luke Ledet", "Revelry Labs"], licenses: ["MIT"], links: %{ "GitHub" => "https://github.com/revelrylabs/ecto_soft_delete" From 11b9311210c07c368b2f04b9f8eccf6e5778f20f Mon Sep 17 00:00:00 2001 From: Stu Page Date: Fri, 7 Mar 2025 13:53:47 -0600 Subject: [PATCH 4/5] changed to 2.1.4 --- mix.exs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mix.exs b/mix.exs index a2290c8..73f02b7 100644 --- a/mix.exs +++ b/mix.exs @@ -4,7 +4,7 @@ defmodule EctoSoftDelete.Mixfile do def project do [ app: :ecto_soft_delete, - version: "2.0.5", + version: "2.1.4", elixir: "~> 1.11", elixirc_paths: elixirc_paths(Mix.env()), build_embedded: Mix.env() == :prod, From 24c54dad2dacac3a46c14fca295369f63b09ec44 Mon Sep 17 00:00:00 2001 From: Stu Page Date: Fri, 7 Mar 2025 13:55:08 -0600 Subject: [PATCH 5/5] reverted back to [{:ecto_soft_delete, "~> 2.0"}] --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 52c0f2e..e705e7e 100644 --- a/README.md +++ b/README.md @@ -136,7 +136,7 @@ Add to mix.exs: ```elixir defp deps do - [{:ecto_soft_delete, "~> 2.0.5"}] + [{:ecto_soft_delete, "~> 2.0"}] end ```