Skip to content

Commit

Permalink
Fixed migrations
Browse files Browse the repository at this point in the history
  • Loading branch information
vigneshhari committed Jul 8, 2022
1 parent b10941b commit 52470f9
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions care/facility/migrations/0297_facility_location.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,16 @@

from django.db import migrations, models

def populate_location(apps, schema_editor):
Facility = apps.get_model('facility', 'Facility')
facilities = Facility.objects.all()

for facility in facilities:
if facility.location is not None:
facility.longitude = facility.location.tuple[0]
facility.latitude = facility.location.tuple[1]
facility.save()
# def populate_location(apps, schema_editor):
# Facility = apps.get_model('facility', 'Facility')
# facilities = Facility.objects.all()

# for facility in facilities:
# if facility.location is not None:
# facility.longitude = facility.location.tuple[0]
# facility.latitude = facility.location.tuple[1]
# facility.save()
# raise Exception()
class Migration(migrations.Migration):

dependencies = [
Expand All @@ -29,7 +29,7 @@ class Migration(migrations.Migration):
name='longitude',
field=models.DecimalField(blank=True, decimal_places=16, max_digits=22, null=True),
),
migrations.RunPython(populate_location, migrations.RunPython.noop),
# migrations.RunPython(populate_location, migrations.RunPython.noop),
migrations.RemoveField(
model_name='facility',
name='location',
Expand Down

0 comments on commit 52470f9

Please sign in to comment.