Experimental migration skip, #build

Changed:
- Add experimental migration skip env var
- Fix nginx double chaching header
This commit is contained in:
Simon 2026-02-05 19:11:40 +07:00
commit a01c0b9458
No known key found for this signature in database
GPG Key ID: 2C15AA5E89985DD4
4 changed files with 37 additions and 5 deletions

View File

@ -17,6 +17,7 @@ from common.src.env_settings import EnvironmentSettings
from common.src.es_connect import ElasticWrap, IndexPaginate
from common.src.helper import clear_dl_cache, get_channels
from common.src.ta_redis import RedisArchivist
from django.conf import settings
from django.core.management.base import BaseCommand, CommandError
from django.utils import dateformat
from django_celery_beat.models import CrontabSchedule, PeriodicTasks
@ -53,6 +54,10 @@ class Command(BaseCommand):
self._update_schedule_tz()
self._init_app_config()
self._set_ta_startup_time()
if self.skip_migrations:
return
self._mig_add_default_playlist_sort()
self._mig_set_channel_tabs()
self._mig_set_video_channel_tabs()
@ -62,6 +67,34 @@ class Command(BaseCommand):
self._mig_fix_channel_description()
self._mig_fix_video_description()
@property
def skip_migrations(self) -> bool:
"""
check if migrations should be skipped.
Experimental, might get replaced in the future.
"""
current_version = settings.TA_VERSION.rstrip("-unstable").upper()
env_var = f"TA_MIG_SKIP_{current_version}"
skipping = bool(os.environ.get(env_var))
self.stdout.write("[MIGRATION] check, experimental")
if skipping:
self.stdout.write(
self.style.SUCCESS(
f" {env_var} is set, skipping migration check"
)
)
else:
self.stdout.write(
self.style.SUCCESS(
" Running migrations. "
+ "If migrations have run for this release, "
+ f"you can set {env_var} to skip the check"
)
)
return skipping
def _make_folders(self):
"""make expected cache folders"""
self.stdout.write("[1] create expected cache folders")

View File

@ -5,7 +5,7 @@ deepdiff==8.6.1
django-auth-ldap==5.3.0
django-celery-beat==2.8.1
django-cors-headers==4.9.0
Django==5.2.10
Django==5.2.11
djangorestframework==3.16.1
drf-spectacular==0.28.0 # rc:ignore
Pillow==12.1.0
@ -13,4 +13,4 @@ redis==7.1.0
requests==2.32.5
ryd-client==0.0.6
uvicorn==0.40.0
yt-dlp[default]==2026.1.29
yt-dlp[default]==2026.2.4

View File

@ -57,14 +57,13 @@ server {
location = /index.html {
add_header Cache-Control "no-store, no-cache, must-revalidate";
add_header Pragma "no-cache";
add_header Expires 0;
expires 0;
}
location / {
add_header Cache-Control "no-store, no-cache, must-revalidate";
add_header Pragma "no-cache";
add_header Expires 0;
expires 0;
try_files $uri $uri/ /index.html =404;
}
}

View File

@ -1,5 +1,5 @@
-r backend/requirements.txt
ipython==9.9.0
ipython==9.10.0
pre-commit==4.5.1
pylint-django==2.7.0
pylint==4.0.4