diff --git a/dandiapi/api/fixtures/playwright.json.xz b/dandiapi/api/fixtures/playwright.json.xz index 3fae1cf6b..116333c2e 100644 Binary files a/dandiapi/api/fixtures/playwright.json.xz and b/dandiapi/api/fixtures/playwright.json.xz differ diff --git a/dandiapi/api/migrations/0011_remove_asset_previous.py b/dandiapi/api/migrations/0011_remove_asset_previous.py new file mode 100644 index 000000000..a74820e46 --- /dev/null +++ b/dandiapi/api/migrations/0011_remove_asset_previous.py @@ -0,0 +1,17 @@ +# Generated by Django 4.1.13 on 2024-08-20 15:14 +from __future__ import annotations + +from django.db import migrations + + +class Migration(migrations.Migration): + dependencies = [ + ('api', '0010_auditrecord'), + ] + + operations = [ + migrations.RemoveField( + model_name='asset', + name='previous', + ), + ] diff --git a/dandiapi/api/models/asset.py b/dandiapi/api/models/asset.py index 7fc106ae4..5e3706647 100644 --- a/dandiapi/api/models/asset.py +++ b/dandiapi/api/models/asset.py @@ -121,13 +121,6 @@ class Status(models.TextChoices): choices=Status.choices, ) validation_errors = models.JSONField(default=list, blank=True, null=True) - previous = models.ForeignKey( - 'Asset', - blank=True, - null=True, - default=None, - on_delete=models.SET_NULL, - ) published = models.BooleanField(default=False) class Meta: diff --git a/dandiapi/api/services/asset/__init__.py b/dandiapi/api/services/asset/__init__.py index 5ea352e8f..e1ef3f4d1 100644 --- a/dandiapi/api/services/asset/__init__.py +++ b/dandiapi/api/services/asset/__init__.py @@ -127,10 +127,6 @@ def change_asset( # noqa: PLR0913 metadata=new_metadata, ) - # Set previous asset and save - new_asset.previous = asset - new_asset.save() - audit.update_asset(dandiset=version.dandiset, user=user, asset=new_asset) return new_asset, True diff --git a/dandiapi/api/tests/test_asset.py b/dandiapi/api/tests/test_asset.py index c2f8889a4..aaf6900de 100644 --- a/dandiapi/api/tests/test_asset.py +++ b/dandiapi/api/tests/test_asset.py @@ -1108,9 +1108,6 @@ def test_asset_rest_update(api_client, user, draft_version, asset, asset_blob): new_asset = Asset.objects.get(asset_id=resp['asset_id']) assert new_asset in draft_version.assets.all() - # The new asset should have a reference to the old asset - assert new_asset.previous == asset - # Ensure new path is ingested assert not AssetPath.objects.filter(path=old_path, version=draft_version).exists() assert AssetPath.objects.filter(path=new_path, version=draft_version).exists() @@ -1168,9 +1165,6 @@ def test_asset_rest_update_embargo(api_client, user, draft_version, asset, embar new_asset = Asset.objects.get(asset_id=resp['asset_id']) assert new_asset in draft_version.assets.all() - # The new asset should have a reference to the old asset - assert new_asset.previous == asset - # The version modified date should be updated start_time = draft_version.modified draft_version.refresh_from_db() @@ -1266,9 +1260,6 @@ def test_asset_rest_update_zarr( new_asset = Asset.objects.get(asset_id=resp['asset_id']) assert new_asset in draft_version.assets.all() - # The new asset should have a reference to the old asset - assert new_asset.previous == asset - # The version modified date should be updated start_time = draft_version.modified draft_version.refresh_from_db()