single quotes in db migrations

This commit is contained in:
Brandon Thomas committed 2026-02-17 23:40:56 +07:00
1 parent 658b15d6aa
commit e0779897b6
5 files changed
+22 -8

No files matched your search

+11 -4
View File
@@ -29,11 +29,18 @@ SECRETS_PATH = "secrets.toml"
# -- Migration query to run in batches --
# Tweak this as needed. Use LIMIT to control batch size.
# QUERY = """
# delete
# from media_files
# where maybe_creator_user_token is null
# limit 10000
# """
QUERY = """
delete
from media_files
where maybe_creator_user_token is null
limit 10000
delete from media_files
where media_type in ("audio", "wav")
and created_at < NOW() - INTERVAL 6 MONTH
limit 10000
"""
BATCH_PAUSE_SECONDS = 0.5
+8 -1
View File
@@ -24,10 +24,17 @@ except ImportError:
SECRETS_PATH = "secrets.toml"
# -- Count query to poll --
# QUERY = """
# select count(*)
# from media_files
# where maybe_creator_user_token is null
# """
QUERY = """
select count(*)
from media_files
where maybe_creator_user_token is null
where media_type in ("audio", "wav")
and created_at < NOW() - INTERVAL 6 MONTH
"""
POLL_INTERVAL_SECONDS = 60