diff options
Diffstat (limited to 'archaeological_operations/migrations/0037_auto_20180903_1015.py')
-rw-r--r-- | archaeological_operations/migrations/0037_auto_20180903_1015.py | 75 |
1 files changed, 75 insertions, 0 deletions
diff --git a/archaeological_operations/migrations/0037_auto_20180903_1015.py b/archaeological_operations/migrations/0037_auto_20180903_1015.py new file mode 100644 index 000000000..b86a88c0a --- /dev/null +++ b/archaeological_operations/migrations/0037_auto_20180903_1015.py @@ -0,0 +1,75 @@ +# -*- coding: utf-8 -*- +# Generated by Django 1.11.10 on 2018-09-03 10:15 +from __future__ import unicode_literals + +from django.conf import settings +import django.contrib.gis.db.models.fields +import django.contrib.postgres.fields.jsonb +import django.contrib.postgres.search +from django.db import migrations, models +import django.db.models.deletion + + +def create_history(apps, schema_editor): + Site = apps.get_model('archaeological_operations', 'ArchaeologicalSite') + if not Site.objects.count(): + return + # living dangerously... + from archaeological_operations.models import ArchaeologicalSite + for site in ArchaeologicalSite.objects.all(): + site.save() + + +class Migration(migrations.Migration): + + dependencies = [ + migrations.swappable_dependency(settings.AUTH_USER_MODEL), + ('archaeological_operations', '0036_auto_20180809_1242'), + ] + + operations = [ + migrations.CreateModel( + name='HistoricalArchaeologicalSite', + fields=[ + ('id', models.IntegerField(auto_created=True, blank=True, db_index=True, verbose_name='ID')), + ('data', django.contrib.postgres.fields.jsonb.JSONField(blank=True, db_index=True, default={})), + ('search_vector', django.contrib.postgres.search.SearchVectorField(blank=True, help_text='Auto filled at save', null=True, verbose_name='Search vector')), + ('reference', models.CharField(db_index=True, max_length=200, verbose_name='Reference')), + ('name', models.CharField(blank=True, max_length=200, null=True, verbose_name='Name')), + ('comment', models.TextField(blank=True, null=True, verbose_name='Comment')), + ('locality_ngi', models.TextField(blank=True, null=True, verbose_name='National Geographic Institute locality')), + ('locality_cadastral', models.TextField(blank=True, null=True, verbose_name='Cadastral locality')), + ('shipwreck_name', models.TextField(blank=True, null=True, verbose_name='Shipwreck name')), + ('oceanographic_service_localisation', models.TextField(blank=True, null=True, verbose_name='Oceanographic service localisation')), + ('shipwreck_code', models.TextField(blank=True, null=True, verbose_name='Shipwreck code')), + ('sinking_date', models.DateField(blank=True, null=True, verbose_name='Sinking date')), + ('discovery_area', models.TextField(blank=True, null=True, verbose_name='Discovery area')), + ('point', django.contrib.gis.db.models.fields.PointField(blank=True, null=True, srid=4326, verbose_name='Point')), + ('multi_polygon', django.contrib.gis.db.models.fields.MultiPolygonField(blank=True, null=True, srid=4326, verbose_name='Multi polygon')), + ('cached_label', models.TextField(blank=True, db_index=True, null=True, verbose_name='Cached name')), + ('history_id', models.AutoField(primary_key=True, serialize=False)), + ('history_date', models.DateTimeField()), + ('history_type', models.CharField(choices=[('+', 'Created'), ('~', 'Changed'), ('-', 'Deleted')], max_length=1)), + ('history_creator', models.ForeignKey(blank=True, db_constraint=False, null=True, on_delete=django.db.models.deletion.DO_NOTHING, related_name='+', to=settings.AUTH_USER_MODEL)), + ('history_modifier', models.ForeignKey(blank=True, db_constraint=False, null=True, on_delete=django.db.models.deletion.DO_NOTHING, related_name='+', to=settings.AUTH_USER_MODEL)), + ('history_user', models.ForeignKey(null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='+', to=settings.AUTH_USER_MODEL)), + ('top_operation', models.ForeignKey(blank=True, db_constraint=False, null=True, on_delete=django.db.models.deletion.DO_NOTHING, related_name='+', to='archaeological_operations.Operation')), + ], + options={ + 'ordering': ('-history_date', '-history_id'), + 'get_latest_by': 'history_date', + 'verbose_name': 'historical Archaeological site', + }, + ), + migrations.AddField( + model_name='archaeologicalsite', + name='multi_polygon', + field=django.contrib.gis.db.models.fields.MultiPolygonField(blank=True, null=True, srid=4326, verbose_name='Multi polygon'), + ), + migrations.AddField( + model_name='archaeologicalsite', + name='point', + field=django.contrib.gis.db.models.fields.PointField(blank=True, null=True, srid=4326, verbose_name='Point'), + ), + migrations.RunPython(create_history), + ] |