chore: prepare for prod

Signed-off-by: SphericalKat <amolele@gmail.com>
This commit is contained in:
sphericalkat committed 2021-08-14 01:19:00 +05:30
1 parent d369c75fa8
commit 5d05a87263
10 files changed
+10491 -6662

No files matched your search

@@ -29,6 +29,8 @@ defmodule KetbinWeb.PageController do
# generate phonetic key
id = Utils.generate_key()
IO.puts(conn.assigns[:current_user])
# check if content is a url
is_url =
Map.get(paste_params, "content")
+32
View File
@@ -0,0 +1,32 @@
defmodule Ketbin.Release do
@moduledoc """
This module is used by the entrypoint to migrate the database
"""
@app :ketbin
require Logger
def migrate do
Application.ensure_all_started(@app)
load_app()
for repo <- repos() do
{:ok, _, _} = Ecto.Migrator.with_repo(repo, &Ecto.Migrator.run(&1, :up, all: true))
end
end
def rollback(repo, version) do
load_app()
{:ok, _, _} = Ecto.Migrator.with_repo(repo, &Ecto.Migrator.run(&1, :down, to: version))
end
defp repos do
Application.fetch_env!(@app, :ecto_repos)
end
defp load_app do
Application.load(@app)
end
end