Skip to content

Commit

Permalink
OpenConceptLab/ocl_issues#1399 | migrations | removed dormant locales…
Browse files Browse the repository at this point in the history
… and old M2M relations
  • Loading branch information
snyaggarwal committed Jan 18, 2023
1 parent 47d6570 commit ed3d6e6
Show file tree
Hide file tree
Showing 4 changed files with 59 additions and 3 deletions.
@@ -0,0 +1,21 @@
# Generated by Django 4.1.3 on 2023-01-18 04:20

from django.db import migrations


class Migration(migrations.Migration):

dependencies = [
('concepts', '0045_rename_localizedtext_conceptname'),
]

operations = [
migrations.RemoveField(
model_name='concept',
name='descriptions_old',
),
migrations.RemoveField(
model_name='concept',
name='names_old',
),
]
18 changes: 18 additions & 0 deletions core/concepts/migrations/0047_auto_20230118_0421.py
@@ -0,0 +1,18 @@
# Generated by Django 4.1.3 on 2023-01-18 04:21

from django.db import migrations


class Migration(migrations.Migration):

dependencies = [
('concepts', '0046_remove_concept_descriptions_old_and_more'),
]

operations = [
migrations.RunSQL(
"""
DELETE FROM concept_names where concept_id is null;
"""
)
]
19 changes: 19 additions & 0 deletions core/concepts/migrations/0048_alter_conceptname_concept.py
@@ -0,0 +1,19 @@
# Generated by Django 4.1.3 on 2023-01-18 04:24

from django.db import migrations, models
import django.db.models.deletion


class Migration(migrations.Migration):

dependencies = [
('concepts', '0047_auto_20230118_0421'),
]

operations = [
migrations.AlterField(
model_name='conceptname',
name='concept',
field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='names', to='concepts.concept'),
),
]
4 changes: 1 addition & 3 deletions core/concepts/models.py
Expand Up @@ -112,7 +112,7 @@ def _build(params):

class ConceptName(AbstractLocalizedText):
concept = models.ForeignKey(
'concepts.Concept', on_delete=models.CASCADE, null=True, blank=True, related_name='names')
'concepts.Concept', on_delete=models.CASCADE, related_name='names')

class Meta:
db_table = 'concept_names'
Expand Down Expand Up @@ -216,8 +216,6 @@ class Meta:
external_id = models.TextField(null=True, blank=True)
concept_class = models.TextField()
datatype = models.TextField()
names_old = models.ManyToManyField(ConceptName, related_name='name_locales')
descriptions_old = models.ManyToManyField(ConceptName, related_name='description_locales')
comment = models.TextField(null=True, blank=True)
parent = models.ForeignKey('sources.Source', related_name='concepts_set', on_delete=models.CASCADE)
sources = models.ManyToManyField('sources.Source', related_name='concepts')
Expand Down

0 comments on commit ed3d6e6

Please sign in to comment.