X-Git-Url: http://git.squeep.com/?a=blobdiff_plain;f=lib%2Fpleroma%2Frelease_tasks.ex;h=02dd6c325db8fc13e1bfae53522c4694534220e6;hb=ac672a9d6bfdd3cba7692f80a883bd38b0b09a57;hp=7726bc635836c2d4859c492efc73b26cc767f282;hpb=2a659b35f16cacb39ea6dae2aefd3572f4be6783;p=akkoma
diff --git a/lib/pleroma/release_tasks.ex b/lib/pleroma/release_tasks.ex
index 7726bc635..02dd6c325 100644
--- a/lib/pleroma/release_tasks.ex
+++ b/lib/pleroma/release_tasks.ex
@@ -1,23 +1,23 @@
# Pleroma: A lightweight social networking server
-# Copyright © 2017-2019 Pleroma Authors
+# Copyright © 2017-2020 Pleroma Authors
# SPDX-License-Identifier: AGPL-3.0-only
defmodule Pleroma.ReleaseTasks do
@repo Pleroma.Repo
def run(args) do
- Mix.Tasks.Pleroma.Common.start_pleroma()
[task | args] = String.split(args)
case task do
- "migrate" -> migrate()
+ "migrate" -> migrate(args)
"create" -> create()
- "rollback" -> rollback(String.to_integer(Enum.at(args, 0)))
+ "rollback" -> rollback(args)
task -> mix_task(task, args)
end
end
defp mix_task(task, args) do
+ Application.load(:pleroma)
{:ok, modules} = :application.get_key(:pleroma, :modules)
module =
@@ -35,15 +35,17 @@ defmodule Pleroma.ReleaseTasks do
end
end
- def migrate do
- {:ok, _, _} = Ecto.Migrator.with_repo(@repo, &Ecto.Migrator.run(&1, :up, all: true))
+ def migrate(args) do
+ Mix.Tasks.Pleroma.Ecto.Migrate.run(args)
end
- def rollback(version) do
- {:ok, _, _} = Ecto.Migrator.with_repo(@repo, &Ecto.Migrator.run(&1, :down, to: version))
+ def rollback(args) do
+ Mix.Tasks.Pleroma.Ecto.Rollback.run(args)
end
def create do
+ Application.load(:pleroma)
+
case @repo.__adapter__.storage_up(@repo.config) do
:ok ->
IO.puts("The database for #{inspect(@repo)} has been created")