Skip to content

Conversation

@obarbier
Copy link

psql always connects to the database that matches the user name, unless you explicitly provide a database name.

update only postgresql flow to allow other database_name

@obarbier
Copy link
Author

this is to help solve #328

@j0k3r j0k3r requested a review from Kdecherf November 27, 2025 12:34
DATABASE_EXISTS="$(psql -qAt -h "${SYMFONY__ENV__DATABASE_HOST}" -p "${SYMFONY__ENV__DATABASE_PORT}" -U "${POSTGRES_USER}" \
-c "SELECT 1 FROM pg_catalog.pg_database WHERE datname = '${SYMFONY__ENV__DATABASE_NAME}';")"
TABLE_EXISTS="$(psql -qAt -h "${SYMFONY__ENV__DATABASE_HOST}" -p "${SYMFONY__ENV__DATABASE_PORT}" -U "${POSTGRES_USER}" \
-c "SELECT 1 FROM information_schema.tables WHERE table_name = 'wallabag_user';")"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The table wallabag_user may have a different name on some installations as a prefix can be set using $SYMFONY__ENV__DATABASE_TABLE_PREFIX


# Configure Postgres database
if [ "$SYMFONY__ENV__DATABASE_DRIVER" = "pdo_pgsql" ] && [ "$POPULATE_DATABASE" = "True" ] && [ "$POSTGRES_PASSWORD" != "" ] ; then
if [ -z "$POSTGRES_DATABASE_NAME" ]; then
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We already rely on POSTGRES_USER and POSTGRES_PASSWORD that are provided by the postgresql docker image. I think we can also rely on POSTGRES_DB to avoid creating a new variable

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants