feat: add logging to make it easier to debug init-db script
This commit is contained in:
1 parent
adfd696d49
commit
d97ce0094c
1 file changed
+4
@@ -15,17 +15,21 @@ if [ -n "$ODOO_DATABASE" ]; then
|
||||
|
||||
entrypoint-log "Check if database $ODOO_DATABASE exists."
|
||||
DATABASE_EXISTS=$(exec psql "postgres://$PGUSER:$PGPASSWORD@$PGHOST:$PGPORT/postgres" -tAc "SELECT COUNT(*) FROM pg_database WHERE datname = '$ODOO_DATABASE'")
|
||||
entrypoint-log "Database exists check result: $DATABASE_EXISTS"
|
||||
|
||||
# If it does not exist, create it
|
||||
if [ "$DATABASE_EXISTS" = "0" ]; then
|
||||
entrypoint-log "Create database $ODOO_DATABASE."
|
||||
(exec psql "postgres://$PGUSER:$PGPASSWORD@$PGHOST:$PGPORT/postgres" -tAc "CREATE DATABASE \"$ODOO_DATABASE\";") || true
|
||||
else
|
||||
entrypoint-log "Database $ODOO_DATABASE already exists"
|
||||
fi
|
||||
|
||||
entrypoint-log "Check if database $ODOO_DATABASE is initialized"
|
||||
DATABASE_INITIALIZED=$(exec psql "postgres://$PGUSER:$PGPASSWORD@$PGHOST:$PGPORT/$ODOO_DATABASE" -tAc "SELECT COUNT(*) FROM information_schema.tables WHERE table_name = 'ir_module_module'")
|
||||
|
||||
if [ "$DATABASE_INITIALIZED" = "0" ]; then
|
||||
entrypoint-log "Database not initialized, starting initialization process"
|
||||
ODOO_INIT_LOGIN=${ODOO_INIT_LOGIN:="admin"}
|
||||
ODOO_INIT_PASSWORD=${ODOO_INIT_PASSWORD:="admin"}
|
||||
ODOO_INIT_LANG=${ODOO_INIT_LANG:="en_US"}
|
||||
|
||||
Reference in new issue
Block a user