Skip to content

Commit

Permalink
Re-do migrations for cedar metadata template and record
Browse files Browse the repository at this point in the history
  • Loading branch information
cslzchen committed Feb 2, 2024
1 parent 0a507de commit 848197f
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 37 deletions.
34 changes: 0 additions & 34 deletions osf/migrations/0018_cedarmetadatarecord.py

This file was deleted.

Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -9,7 +10,7 @@
class Migration(migrations.Migration):

dependencies = [
('osf', '0016_auto_20230828_1810'),
('osf', '0018_merge_20231218_1446'),
]

operations = [
Expand All @@ -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),
),
]
2 changes: 1 addition & 1 deletion osf/models/cedar_metadata.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 848197f

Please sign in to comment.