#!/bin/sh
set -eu

if [ "${0##*.}" = 'post-upgrade' ]; then
	cat >&2 <<-EOF
	*
	* To finish Mastodon upgrade run:
	*
	*     mastodon-rails db:migrate
	*
	EOF
else
	cat >&2 <<-EOF
	*
	* 1. Adjust settings in /etc/mastodon.conf
	*
	* 2. Create database for Mastodon:
	*
	*     psql -c "CREATE ROLE mastodon PASSWORD 'top-secret' INHERIT LOGIN;"
	*     psql -c "CREATE DATABASE mastodon OWNER mastodon ENCODING 'UTF-8';"
	*     psql -d mastodon -c "CREATE EXTENSION pg_trgm; CREATE EXTENSION btree_gist;"
	*     psql -c "ALTER DATABASE name OWNER TO new_owner;"
	*
	* 3. Run "mastodon-rake db:migrate"
	*
	EOF
fi
