add release files
This commit is contained in:
parent
fa866cc10e
commit
918229f8c6
|
@ -28,6 +28,8 @@ chiya-*.tar
|
|||
# Ignore assets that are produced by build tools.
|
||||
/priv/static/assets/
|
||||
|
||||
/priv/static/*
|
||||
|
||||
# Ignore digested assets cache.
|
||||
/priv/static/cache_manifest.json
|
||||
|
||||
|
@ -35,3 +37,5 @@ chiya-*.tar
|
|||
npm-debug.log
|
||||
/assets/node_modules/
|
||||
|
||||
# env file
|
||||
.env
|
||||
|
|
|
@ -0,0 +1,28 @@
|
|||
defmodule Chiya.Release do
|
||||
@moduledoc """
|
||||
Used for executing DB release tasks when run in production without Mix
|
||||
installed.
|
||||
"""
|
||||
@app :chiya
|
||||
|
||||
def migrate do
|
||||
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
|
|
@ -0,0 +1,3 @@
|
|||
#!/bin/sh
|
||||
cd -P -- "$(dirname -- "$0")"
|
||||
exec ./chiya eval Chiya.Release.migrate
|
|
@ -0,0 +1 @@
|
|||
call "%~dp0\chiya" eval Chiya.Release.migrate
|
|
@ -0,0 +1,3 @@
|
|||
#!/bin/sh
|
||||
cd -P -- "$(dirname -- "$0")"
|
||||
PHX_SERVER=true exec ./chiya start
|
|
@ -0,0 +1,2 @@
|
|||
set PHX_SERVER=true
|
||||
call "%~dp0\chiya" start
|
Loading…
Reference in New Issue