2019-06-08 10:15:49 -04:00
|
|
|
#!/bin/sh
|
|
|
|
# XXX: This should be removed when elixir's releases get custom command support
|
2019-06-13 15:16:57 -04:00
|
|
|
if [ -z "$1" ] || [ "$1" = "help" ]; then
|
2019-06-17 17:17:47 -04:00
|
|
|
echo "Usage: $(basename "$0") COMMAND [ARGS]
|
2019-06-09 06:33:44 -04:00
|
|
|
|
|
|
|
The known commands are:
|
|
|
|
|
2019-06-09 06:34:58 -04:00
|
|
|
create Create database schema (needs to be executed only once)
|
|
|
|
migrate Execute database migrations (needs to be done after updates)
|
|
|
|
rollback [VERSION] Rollback database migrations (needs to be done before downgrading)
|
2019-06-09 06:33:44 -04:00
|
|
|
|
|
|
|
and any mix tasks under Pleroma namespace, for example \`mix pleroma.user COMMAND\` is
|
2019-06-10 07:47:22 -04:00
|
|
|
equivalent to \`$(basename "$0") user COMMAND\`
|
2019-06-17 17:17:47 -04:00
|
|
|
|
|
|
|
By default pleroma_ctl will try calling into a running instance to execute non migration-related commands,
|
|
|
|
if for some reason this is undesired, set PLEROMA_CTL_RPC_DISABLED environment variable
|
2019-06-09 06:33:44 -04:00
|
|
|
"
|
|
|
|
else
|
2019-06-17 17:17:47 -04:00
|
|
|
SCRIPT=$(readlink -f "$0")
|
|
|
|
SCRIPTPATH=$(dirname "$SCRIPT")
|
|
|
|
if [ "$1" = "migrate" ] || [ "$1" = "rollback" ] || [ "$1" = "create" ] || [ -n "$PLEROMA_CTL_RPC_DISABLED" ]; then
|
|
|
|
"$SCRIPTPATH"/pleroma eval 'Pleroma.ReleaseTasks.run("'"$*"'")'
|
|
|
|
else
|
|
|
|
"$SCRIPTPATH"/pleroma rpc 'Pleroma.ReleaseTasks.run("'"$*"'")'
|
|
|
|
fi
|
2019-06-09 06:33:44 -04:00
|
|
|
fi
|