-
Notifications
You must be signed in to change notification settings - Fork 45
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Objects of the Manifest class no longer store the manifest data (raw binary json data) in a linked artifact. Instead, a new TextField called 'data' was added to the Manifest class itself. closes #1288
- Loading branch information
1 parent
ef0a194
commit 9093664
Showing
12 changed files
with
184 additions
and
237 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
Manifest model is now artifactless, the manifest data is stored in a new 'data' field instead. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
# Generated by Django 4.2.10 on 2024-03-05 11:22 | ||
|
||
from django.db import migrations, models | ||
|
||
|
||
def move_manifest_data(apps, schema_editor): | ||
""" | ||
Move the data from the manifest's linked file to the new data field. | ||
""" | ||
Manifest = apps.get_model("container", "Manifest") | ||
|
||
for manifest in Manifest.objects.all(): | ||
artifact = manifest._artifacts.first() | ||
if not artifact: | ||
continue | ||
|
||
file = artifact.file | ||
json_data_text = file.read() | ||
file.close() | ||
|
||
manifest.data = json_data_text | ||
manifest._artifacts.clear() | ||
manifest.save() | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
dependencies = [ | ||
('container', '0038_add_manifest_metadata_fields'), | ||
] | ||
|
||
operations = [ | ||
migrations.AddField( | ||
model_name='manifest', | ||
name='data', | ||
field=models.TextField(default=''), | ||
), | ||
migrations.RunPython(move_manifest_data), | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.