Don't run postgres migrate on a new DB
continuous-integration/drone/push Build is failing Details

This commit is contained in:
3wc 2023-07-19 11:41:20 +01:00
parent e487a36bb5
commit 68f23084aa
1 changed files with 27 additions and 25 deletions

View File

@ -11,9 +11,10 @@ if [ -e $MIGRATION_MARKER ]; then
exit 1
fi
DATA_VERSION=$(cat $PGDATA/PG_VERSION)
if [ -f $PGDATA/PG_VERSION ]; then
DATA_VERSION=$(cat $PGDATA/PG_VERSION)
if [ -n "$DATA_VERSION" -a "$PG_MAJOR" != "$DATA_VERSION" ]; then
if [ -n "$DATA_VERSION" -a "$PG_MAJOR" != "$DATA_VERSION" ]; then
echo "postgres data version $DATA_VERSION found, but need $PG_MAJOR. Starting migration"
echo "Installing postgres $DATA_VERSION"
sed -i "s/$/ $DATA_VERSION/" /etc/apt/sources.list.d/pgdg.list
@ -37,6 +38,7 @@ if [ -n "$DATA_VERSION" -a "$PG_MAJOR" != "$DATA_VERSION" ]; then
rmdir $NEWDATA
rm $MIGRATION_MARKER
echo "migration complete"
fi
fi
/usr/local/bin/docker-entrypoint.sh postgres