projects
/
akkoma
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Add test
[akkoma]
/
lib
/
pleroma
/
release_tasks.ex
diff --git
a/lib/pleroma/release_tasks.ex
b/lib/pleroma/release_tasks.ex
index 7726bc635836c2d4859c492efc73b26cc767f282..8afabf463f9ebc165a3d06a8b61ec434bf351dd3 100644
(file)
--- a/
lib/pleroma/release_tasks.ex
+++ b/
lib/pleroma/release_tasks.ex
@@
-6,18
+6,18
@@
defmodule Pleroma.ReleaseTasks do
@repo Pleroma.Repo
def run(args) do
@repo Pleroma.Repo
def run(args) do
- Mix.Tasks.Pleroma.Common.start_pleroma()
[task | args] = String.split(args)
case task do
[task | args] = String.split(args)
case task do
- "migrate" -> migrate()
+ "migrate" -> migrate(
args
)
"create" -> create()
"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
task -> mix_task(task, args)
end
end
defp mix_task(task, args) do
+ Application.load(:pleroma)
{:ok, modules} = :application.get_key(:pleroma, :modules)
module =
{:ok, modules} = :application.get_key(:pleroma, :modules)
module =
@@
-35,15
+35,17
@@
defmodule Pleroma.ReleaseTasks do
end
end
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
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
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")
case @repo.__adapter__.storage_up(@repo.config) do
:ok ->
IO.puts("The database for #{inspect(@repo)} has been created")