Skip to content

Commit c94c87b

Browse files
committed
🗃️(backend) fix storage_location for existing documents
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 11cc20c commit c94c87b

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
# Generated by Django 5.0.9 on 2025-06-11 17:34
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+
"""Update the storage_location field for existing documents."""
10+
Document = apps.get_model("core", "Document")
11+
Document.objects.filter(storage_location="AWS_S3").update(storage_location=AWS_S3)
12+
13+
14+
class Migration(migrations.Migration):
15+
dependencies = [
16+
("core", "0085_document_filename_document_storage_location_and_more"),
17+
]
18+
19+
operations = [
20+
migrations.RunPython(fix_storage_location_to_aws, migrations.RunPython.noop),
21+
]

0 commit comments

Comments
 (0)