2022-06-22 12:53:14 +02:00
|
|
|
# pylint: disable=invalid-name
|
|
|
|
|
2022-05-28 16:27:57 +02:00
|
|
|
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",
|
2022-06-26 16:09:09 +02:00
|
|
|
before=update_disk_usage,
|
2022-05-28 16:27:57 +02:00
|
|
|
)
|
|
|
|
)
|
|
|
|
]
|