Skip to content

Commit

Permalink
feat: Add migration to remove all Observation* events that are differ…
Browse files Browse the repository at this point in the history
…ent only in newline style
  • Loading branch information
dragonee committed Oct 12, 2024
1 parent 0654758 commit ec2d48b
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 2 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
# Generated by Django 4.2.16 on 2024-10-12 14:32

from django.db import migrations


def forward_func(apps, schema_editor):
ObservationRecontextualized = apps.get_model('tree', 'ObservationRecontextualized')
ObservationReinterpreted = apps.get_model('tree', 'ObservationReinterpreted')
ObservationReflectedUpon = apps.get_model('tree', 'ObservationReflectedUpon')

db_alias = schema_editor.connection.alias

model_mapping = {
ObservationRecontextualized: 'situation',
ObservationReinterpreted: 'interpretation',
ObservationReflectedUpon: 'approach'
}

for model, field in model_mapping.items():
for instance in model.objects.using(db_alias).all():
if getattr(instance, field).strip().replace('\r', '') == getattr(instance, f'old_{field}').strip().replace('\r', ''):
instance.delete()


class Migration(migrations.Migration):

dependencies = [
("tree", "0040_remove_empty_reflections_and_plans"),
]

operations = [migrations.RunPython(forward_func, migrations.RunPython.noop)]
2 changes: 0 additions & 2 deletions tasks/assets/app.scss
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
// Load specific styles from styles/ here.

@import 'bootstrap/components/dropdown';

@import url('https://fonts.googleapis.com/css?family=Raleway:300,400,400i,500,700&display=swap&subset=latin-ext');

@import '~vue-context/src/sass/vue-context.scss';
Expand Down

0 comments on commit ec2d48b

Please sign in to comment.