-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
projects: fix point migration by splitting it into separate migrations
- Loading branch information
Showing
4 changed files
with
71 additions
and
32 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
30 changes: 30 additions & 0 deletions
30
adhocracy4/projects/migrations/0050_replace_point_field.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
# Generated by Django 4.2.17 on 2025-02-19 15:46 | ||
|
||
import django.contrib.gis.db.models.fields | ||
|
||
from django.db import migrations | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
dependencies = [ | ||
("a4projects", "0049_project_geos_point"), | ||
] | ||
|
||
operations = [ | ||
migrations.RemoveField( | ||
model_name="project", | ||
name="point", | ||
), | ||
migrations.AddField( | ||
model_name="project", | ||
name="point", | ||
field=django.contrib.gis.db.models.fields.PointField( | ||
blank=True, | ||
help_text="Locate your project. Click inside the marked area or type in an address to set the marker. A set marker can be dragged when pressed.", | ||
null=True, | ||
srid=4326, | ||
verbose_name="Can your project be located on the map?", | ||
), | ||
), | ||
] |
23 changes: 23 additions & 0 deletions
23
adhocracy4/projects/migrations/0051_migrate_point_field.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
# Generated by Django 4.2.17 on 2025-02-19 15:49 | ||
|
||
from django.db import migrations | ||
|
||
|
||
def migrate_project_geos_point_field(apps, schema_editor): | ||
project = apps.get_model("a4projects", "Project") | ||
for project in project.objects.all(): | ||
project.point = project.geos_point | ||
project.save() | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
dependencies = [ | ||
("a4projects", "0050_replace_point_field"), | ||
] | ||
|
||
operations = [ | ||
migrations.RunPython( | ||
migrate_project_geos_point_field, reverse_code=migrations.RunPython.noop | ||
), | ||
] |
17 changes: 17 additions & 0 deletions
17
adhocracy4/projects/migrations/0052_remove_geos_point_field.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
# Generated by Django 4.2.17 on 2025-02-19 15:51 | ||
|
||
from django.db import migrations | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
dependencies = [ | ||
("a4projects", "0051_migrate_point_field"), | ||
] | ||
|
||
operations = [ | ||
migrations.RemoveField( | ||
model_name="project", | ||
name="geos_point", | ||
), | ||
] |