Skip to content

Commit

Permalink
Start figuring out how to automatically reindex the database cluster
Browse files Browse the repository at this point in the history
  • Loading branch information
justinclift committed Sep 30, 2024
1 parent fb7ad07 commit c9b30d9
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions docker-entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -572,6 +572,27 @@ _main() {
echo "Removing left over database files is complete"
echo "---------------------------------------------"

# Automatically reindex the databases (if requested)
if [ "${PGAUTO_REINDEX}" = "yes" ]; then
echo "------------------------"
echo "Reindexing the databases"
echo "------------------------"

# Start the database in single user mode
"${OLDPATH}/bin/postgres" --single -D "${POSTGRES_DB}"

# 1. Get the list of databases in the database cluster
# Something like this should work:
# SELECT datname FROM pg_catalog.pg_database WHERE datistemplate IS FALSE;

# 2. For each database, get the list of indexes
# 3. Regenerate the indexes

echo "-------------------------------"
echo "End of reindexing the databases"
echo "-------------------------------"
fi

echo "**********************************************************"
echo "Automatic upgrade process finished with no errors reported"
echo "**********************************************************"
Expand Down

0 comments on commit c9b30d9

Please sign in to comment.