feat: stop supporting pre-tzaware migration database dumps. (#4782)

* feat: stop supporting pre-tzaware migration database dumps.

* chore: remove unnecessary env variable
This commit is contained in:
Robert Sparks 2022-11-28 10:17:22 -06:00 committed by GitHub
parent cb2f4afc8b
commit 2636c59f99
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 5 additions and 65 deletions

View file

@ -150,8 +150,6 @@ jobs:
run: |
echo "Running checks..."
./ietf/manage.py check
./ietf/manage.py migrate || true
echo "USE_TZ = True" >> ./ietf/settings_local.py
./ietf/manage.py migrate
echo "Validating migrations..."
if ! ( ietf/manage.py makemigrations --dry-run --check --verbosity 3 ) ; then

View file

@ -45,10 +45,6 @@ jobs:
run: |
echo "Running checks..."
./ietf/manage.py check
echo "Running migrations with USE_TZ=False..."
./ietf/manage.py migrate || true
echo "USE_TZ = True" >> ./ietf/settings_local.py
echo "Running migrations with USE_TZ=True..."
./ietf/manage.py migrate
echo "Validating migrations..."
if ! ( ietf/manage.py makemigrations --dry-run --check --verbosity 3 ) ; then

View file

@ -11,29 +11,9 @@ echo "Running Datatracker checks..."
./ietf/manage.py check
# Migrate, adjusting to what the current state of the underlying database might be:
WORKSPACEDIR=.
if ietf/manage.py showmigrations | grep "\[ \] 0003_pause_to_change_use_tz"; then
if grep "USE_TZ" $WORKSPACEDIR/ietf/settings_local.py; then
cat $WORKSPACEDIR/ietf/settings_local.py | sed 's/USE_TZ.*$/USE_TZ = False/' > /tmp/settings_local.py && mv /tmp/settings_local.py $WORKSPACEDIR/ietf/settings_local.py
else
echo "USE_TZ = False" >> $WORKSPACEDIR/ietf/settings_local.py
fi
echo "Running Datatracker migrations with USE_TZ = False..."
# This is expected to exit non-zero at the pause
/usr/local/bin/python $WORKSPACEDIR/ietf/manage.py migrate --settings=settings_local || true
cat $WORKSPACEDIR/ietf/settings_local.py | sed 's/USE_TZ.*$/USE_TZ = True/' > /tmp/settings_local.py && mv /tmp/settings_local.py $WORKSPACEDIR/ietf/settings_local.py
echo "Running Datatracker migrations with USE_TZ = True..."
/usr/local/bin/python $WORKSPACEDIR/ietf/manage.py migrate --settings=settings_local
else
if grep "USE_TZ" $WORKSPACEDIR/ietf/settings_local.py; then
cat $WORKSPACEDIR/ietf/settings_local.py | sed 's/USE_TZ.*$/USE_TZ = True/' > /tmp/settings_local.py && mv /tmp/settings_local.py $WORKSPACEDIR/ietf/settings_local.py
else
echo "USE_TZ = True" >> $WORKSPACEDIR/ietf/settings_local.py
echo "Running Datatracker migrations..."
/usr/local/bin/python $WORKSPACEDIR/ietf/manage.py migrate --settings=settings_local
fi
fi
echo "Running Datatracker migrations..."
/usr/local/bin/python ./ietf/manage.py migrate --settings=settings_local
echo "Starting Datatracker..."
./ietf/manage.py runserver 0.0.0.0:8000 --settings=settings_local

View file

@ -14,22 +14,5 @@ chmod +x ./docker/scripts/app-create-dirs.sh
./docker/scripts/app-create-dirs.sh
./ietf/manage.py check
if ./ietf/manage.py showmigrations | grep "\[ \] 0003_pause_to_change_use_tz"; then
if grep "USE_TZ" ./ietf/settings_local.py; then
cat ./ietf/settings_local.py | sed 's/USE_TZ.*$/USE_TZ = False/' > /tmp/settings_local.py && mv /tmp/settings_local.py ./ietf/settings_local.py
else
echo "USE_TZ = False" >> ./ietf/settings_local.py
fi
# This is expected to exit non-zero at the pause
/usr/local/bin/python ./ietf/manage.py migrate || true
cat ./ietf/settings_local.py | sed 's/USE_TZ.*$/USE_TZ = True/' > /tmp/settings_local.py && mv /tmp/settings_local.py ./ietf/settings_local.py
/usr/local/bin/python ./ietf/manage.py migrate
./ietf/manage.py migrate
else
if grep "USE_TZ" ./ietf/settings_local.py; then
cat ./ietf/settings_local.py | sed 's/USE_TZ.*$/USE_TZ = True/' > /tmp/settings_local.py && mv /tmp/settings_local.py ./ietf/settings_local.py
else
echo "USE_TZ = True" >> ./ietf/settings_local.py
/usr/local/bin/python ./ietf/manage.py migrate
fi
fi

View file

@ -103,25 +103,8 @@ echo "Running initial checks..."
# Migrate, adjusting to what the current state of the underlying database might be:
if ietf/manage.py showmigrations | grep "\[ \] 0003_pause_to_change_use_tz"; then
if grep "USE_TZ" $WORKSPACEDIR/ietf/settings_local.py; then
cat $WORKSPACEDIR/ietf/settings_local.py | sed 's/USE_TZ.*$/USE_TZ = False/' > /tmp/settings_local.py && mv /tmp/settings_local.py $WORKSPACEDIR/ietf/settings_local.py
else
echo "USE_TZ = False" >> $WORKSPACEDIR/ietf/settings_local.py
fi
# This is expected to exit non-zero at the pause
/usr/local/bin/python $WORKSPACEDIR/ietf/manage.py migrate --settings=settings_local || true
cat $WORKSPACEDIR/ietf/settings_local.py | sed 's/USE_TZ.*$/USE_TZ = True/' > /tmp/settings_local.py && mv /tmp/settings_local.py $WORKSPACEDIR/ietf/settings_local.py
/usr/local/bin/python $WORKSPACEDIR/ietf/manage.py migrate --settings=settings_local
/usr/local/bin/python $WORKSPACEDIR/ietf/manage.py migrate --settings=settings_local
else
if grep "USE_TZ" $WORKSPACEDIR/ietf/settings_local.py; then
cat $WORKSPACEDIR/ietf/settings_local.py | sed 's/USE_TZ.*$/USE_TZ = True/' > /tmp/settings_local.py && mv /tmp/settings_local.py $WORKSPACEDIR/ietf/settings_local.py
else
echo "USE_TZ = True" >> $WORKSPACEDIR/ietf/settings_local.py
/usr/local/bin/python $WORKSPACEDIR/ietf/manage.py migrate --settings=settings_local
fi
fi
echo "-----------------------------------------------------------------"
echo "Done!"

View file

@ -114,7 +114,7 @@ SITE_ID = 1
# to load the internationalization machinery.
USE_I18N = False
USE_TZ = False
USE_TZ = True
if SERVER_MODE == 'production':
MEDIA_ROOT = '/a/www/www6s/lib/dt/media/'