Add migration

This commit is contained in:
Luke Murphy 2020-03-12 16:35:13 +01:00
parent 59beb3a092
commit 61f53bbb7e
No known key found for this signature in database
GPG Key ID: 5E2EF5A63E3718CC

View File

@ -2,10 +2,16 @@
set -eu -o pipefail
setup_db() {
set -eu
gitea migrate
}
setup_root_user() {
set -eu
user_count=$(sqlite3 /data/gitea.db "SELECT count(*) FROM user;")
user_count=$(sqlite3 /data/gitea.db "SELECT count(*) FROM USER;")
if [[ "${user_count}" == "0" ]]; then
echo "==> Setting up root user for first run"
@ -22,6 +28,7 @@ setup_root_user() {
main() {
set -eu
setup_db
setup_root_user
}