aboutsummaryrefslogtreecommitdiff
path: root/lib/mix/tasks/pleroma/ecto
diff options
context:
space:
mode:
Diffstat (limited to 'lib/mix/tasks/pleroma/ecto')
-rw-r--r--lib/mix/tasks/pleroma/ecto/ecto.ex50
-rw-r--r--lib/mix/tasks/pleroma/ecto/migrate.ex4
-rw-r--r--lib/mix/tasks/pleroma/ecto/rollback.ex4
3 files changed, 8 insertions, 50 deletions
diff --git a/lib/mix/tasks/pleroma/ecto/ecto.ex b/lib/mix/tasks/pleroma/ecto/ecto.ex
deleted file mode 100644
index 3363cd45f..000000000
--- a/lib/mix/tasks/pleroma/ecto/ecto.ex
+++ /dev/null
@@ -1,50 +0,0 @@
-# Pleroma: A lightweight social networking server
-# Copyright © 2017-2020 Pleroma Authors <https://pleroma.social/>
-# SPDX-License-Identifier: AGPL-3.0-onl
-
-defmodule Mix.Tasks.Pleroma.Ecto do
- @doc """
- Ensures the given repository's migrations path exists on the file system.
- """
- @spec ensure_migrations_path(Ecto.Repo.t(), Keyword.t()) :: String.t()
- def ensure_migrations_path(repo, opts) do
- path = opts[:migrations_path] || Path.join(source_repo_priv(repo), "migrations")
-
- path =
- case Path.type(path) do
- :relative ->
- Path.join(Application.app_dir(:pleroma), path)
-
- :absolute ->
- path
- end
-
- if not File.dir?(path) do
- raise_missing_migrations(Path.relative_to_cwd(path), repo)
- end
-
- path
- end
-
- @doc """
- Returns the private repository path relative to the source.
- """
- def source_repo_priv(repo) do
- config = repo.config()
- priv = config[:priv] || "priv/#{repo |> Module.split() |> List.last() |> Macro.underscore()}"
- Path.join(Application.app_dir(:pleroma), priv)
- end
-
- defp raise_missing_migrations(path, repo) do
- raise("""
- Could not find migrations directory #{inspect(path)}
- for repo #{inspect(repo)}.
- This may be because you are in a new project and the
- migration directory has not been created yet. Creating an
- empty directory at the path above will fix this error.
- If you expected existing migrations to be found, please
- make sure your repository has been properly configured
- and the configured path exists.
- """)
- end
-end
diff --git a/lib/mix/tasks/pleroma/ecto/migrate.ex b/lib/mix/tasks/pleroma/ecto/migrate.ex
index bc8ed29fb..e903bd171 100644
--- a/lib/mix/tasks/pleroma/ecto/migrate.ex
+++ b/lib/mix/tasks/pleroma/ecto/migrate.ex
@@ -41,6 +41,10 @@ defmodule Mix.Tasks.Pleroma.Ecto.Migrate do
load_pleroma()
{opts, _} = OptionParser.parse!(args, strict: @switches, aliases: @aliases)
+ if Application.get_env(:pleroma, Pleroma.Repo)[:ssl] do
+ Application.ensure_all_started(:ssl)
+ end
+
opts =
if opts[:to] || opts[:step] || opts[:all],
do: opts,
diff --git a/lib/mix/tasks/pleroma/ecto/rollback.ex b/lib/mix/tasks/pleroma/ecto/rollback.ex
index f43bd0b98..3dba952cb 100644
--- a/lib/mix/tasks/pleroma/ecto/rollback.ex
+++ b/lib/mix/tasks/pleroma/ecto/rollback.ex
@@ -40,6 +40,10 @@ defmodule Mix.Tasks.Pleroma.Ecto.Rollback do
load_pleroma()
{opts, _} = OptionParser.parse!(args, strict: @switches, aliases: @aliases)
+ if Application.get_env(:pleroma, Pleroma.Repo)[:ssl] do
+ Application.ensure_all_started(:ssl)
+ end
+
opts =
if opts[:to] || opts[:step] || opts[:all],
do: opts,