Skip to content

Commit 8206e63

Browse files
committed
🗃️(backend) fix storage_location for existing deposited files
The `storage location` field was introduced in a previous release and filled with a default value "AWS_S3". However, the correct enum value is "AWS".
1 parent e855c9f commit 8206e63

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
# Generated by Django 5.0.9 on 2025-07-14 13:31
2+
3+
from django.db import migrations
4+
5+
from marsha.core.defaults import AWS_S3
6+
7+
8+
def fix_storage_location_to_aws(apps, schema_editor):
9+
"""Fix the storage_location field for existing deposited files on AWS."""
10+
DepositedFile = apps.get_model("deposit", "DepositedFile")
11+
DepositedFile.objects.filter(storage_location="AWS_S3").update(
12+
storage_location=AWS_S3
13+
)
14+
15+
16+
class Migration(migrations.Migration):
17+
dependencies = [
18+
("deposit", "0007_depositedfile_fill_storage_location"),
19+
]
20+
21+
operations = [
22+
migrations.RunPython(fix_storage_location_to_aws, migrations.RunPython.noop),
23+
]

0 commit comments

Comments
 (0)