#!/bin/sh
set -eu

mariadb -uroot -p"${MARIADB_ROOT_PASSWORD}" <<EOSQL
CREATE DATABASE IF NOT EXISTS \`${UPTIMEKUMA_DB_NAME}\` CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
CREATE USER IF NOT EXISTS '${UPTIMEKUMA_DB_USER}'@'%' IDENTIFIED BY '${UPTIMEKUMA_DB_PASS}';
GRANT ALL PRIVILEGES ON \`${UPTIMEKUMA_DB_NAME}\`.* TO '${UPTIMEKUMA_DB_USER}'@'%';
FLUSH PRIVILEGES;
EOSQL
