diff --git a/osf/migrations/0018_cedarmetadatarecord.py b/osf/migrations/0018_cedarmetadatarecord.py deleted file mode 100644 index 5bc1778c08a..00000000000 --- a/osf/migrations/0018_cedarmetadatarecord.py +++ /dev/null @@ -1,34 +0,0 @@ -# Generated by Django 3.2.17 on 2023-12-14 17:06 - -from django.db import migrations, models -import django.db.models.deletion -import django_extensions.db.fields -import osf.models.base -import osf.utils.datetime_aware_jsonfield - - -class Migration(migrations.Migration): - - dependencies = [ - ('osf', '0017_cedarmetadatatemplate'), - ] - - operations = [ - migrations.CreateModel( - name='CedarMetadataRecord', - fields=[ - ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), - ('created', django_extensions.db.fields.CreationDateTimeField(auto_now_add=True, verbose_name='created')), - ('modified', django_extensions.db.fields.ModificationDateTimeField(auto_now=True, verbose_name='modified')), - ('_id', models.CharField(db_index=True, default=osf.models.base.generate_object_id, max_length=24, unique=True)), - ('metadata', osf.utils.datetime_aware_jsonfield.DateTimeAwareJSONField(default=dict, encoder=osf.utils.datetime_aware_jsonfield.DateTimeAwareJSONEncoder)), - ('is_published', models.BooleanField(default=False)), - ('guid', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='osf.guid')), - ('template', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='osf.cedarmetadatatemplate')), - ], - options={ - 'unique_together': {('guid', 'template')}, - }, - bases=(models.Model, osf.models.base.QuerySetExplainMixin), - ), - ] diff --git a/osf/migrations/0017_cedarmetadatatemplate.py b/osf/migrations/0019_cedarmetadatarecord_cedarmetadatatemplate.py similarity index 51% rename from osf/migrations/0017_cedarmetadatatemplate.py rename to osf/migrations/0019_cedarmetadatarecord_cedarmetadatatemplate.py index 57d2a65f3b5..0ae24060d30 100644 --- a/osf/migrations/0017_cedarmetadatatemplate.py +++ b/osf/migrations/0019_cedarmetadatarecord_cedarmetadatatemplate.py @@ -1,6 +1,7 @@ -# Generated by Django 3.2.17 on 2023-12-08 17:06 +# Generated by Django 3.2.17 on 2024-02-02 15:12 from django.db import migrations, models +import django.db.models.deletion import django_extensions.db.fields import osf.models.base import osf.utils.datetime_aware_jsonfield @@ -9,7 +10,7 @@ class Migration(migrations.Migration): dependencies = [ - ('osf', '0016_auto_20230828_1810'), + ('osf', '0018_merge_20231218_1446'), ] operations = [ @@ -31,4 +32,21 @@ class Migration(migrations.Migration): }, bases=(models.Model, osf.models.base.QuerySetExplainMixin), ), + migrations.CreateModel( + name='CedarMetadataRecord', + fields=[ + ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('created', django_extensions.db.fields.CreationDateTimeField(auto_now_add=True, verbose_name='created')), + ('modified', django_extensions.db.fields.ModificationDateTimeField(auto_now=True, verbose_name='modified')), + ('_id', models.CharField(db_index=True, default=osf.models.base.generate_object_id, max_length=24, unique=True)), + ('metadata', osf.utils.datetime_aware_jsonfield.DateTimeAwareJSONField(default=dict, encoder=osf.utils.datetime_aware_jsonfield.DateTimeAwareJSONEncoder)), + ('is_published', models.BooleanField(default=False)), + ('guid', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='cedar_metadata_records', to='osf.guid')), + ('template', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='osf.cedarmetadatatemplate')), + ], + options={ + 'unique_together': {('guid', 'template')}, + }, + bases=(models.Model, osf.models.base.QuerySetExplainMixin), + ), ] diff --git a/osf/models/cedar_metadata.py b/osf/models/cedar_metadata.py index 4abe5411685..b196d3cc05d 100644 --- a/osf/models/cedar_metadata.py +++ b/osf/models/cedar_metadata.py @@ -23,7 +23,7 @@ def get_semantic_iri(self): class CedarMetadataRecord(ObjectIDMixin, BaseModel): - guid = models.ForeignKey('Guid', on_delete=models.CASCADE) + guid = models.ForeignKey('Guid', on_delete=models.CASCADE, related_name='cedar_metadata_records') template = models.ForeignKey('CedarMetadataTemplate', on_delete=models.CASCADE) metadata = DateTimeAwareJSONField(default=dict) is_published = models.BooleanField(default=False)