sintonia/api/libretime_api/legacy/migrations/0009_2_5_11.py
jo 0e4bc4cacd feat: replace php migration with django migration
- keep latest legacy version in initial migration file
- move propel schema to api legacy app
- remove legacy upgrade tool
2022-06-08 23:23:08 +02:00

33 lines
632 B
Python

from django.db import migrations
from ._migrations import legacy_migration_factory
UP = None
DOWN = None
def update_disk_usage(cursor):
cursor.execute(
"""
UPDATE cc_pref SET valstr = (
SELECT SUM(filesize)
FROM cc_files
)
WHERE keystr = 'disk_usage';
"""
)
class Migration(migrations.Migration):
dependencies = [
("legacy", "0008_2_5_10"),
]
operations = [
migrations.RunPython(
code=legacy_migration_factory(
target="2.5.11",
sql=update_disk_usage,
)
)
]