2016-11-05 10:35:58 +00:00
|
|
|
from django.contrib.gis.db import models
|
|
|
|
from django.db import connection, migrations
|
2015-04-04 16:09:46 +00:00
|
|
|
|
2015-06-19 15:46:03 +00:00
|
|
|
ops = [
|
|
|
|
migrations.CreateModel(
|
|
|
|
name='Neighborhood',
|
|
|
|
fields=[
|
|
|
|
('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)),
|
|
|
|
('name', models.CharField(max_length=100, unique=True)),
|
2016-11-05 10:35:58 +00:00
|
|
|
('geom', models.MultiPolygonField(srid=4326)),
|
2015-06-19 15:46:03 +00:00
|
|
|
],
|
|
|
|
options={
|
|
|
|
'required_db_features': ['gis_enabled'],
|
|
|
|
},
|
|
|
|
bases=(models.Model,),
|
|
|
|
),
|
|
|
|
migrations.CreateModel(
|
|
|
|
name='Household',
|
|
|
|
fields=[
|
|
|
|
('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)),
|
2015-07-22 14:43:21 +00:00
|
|
|
('neighborhood', models.ForeignKey(
|
|
|
|
'gis_migrations.Neighborhood',
|
|
|
|
models.SET_NULL,
|
|
|
|
to_field='id',
|
|
|
|
null=True,
|
|
|
|
)),
|
2015-06-19 15:46:03 +00:00
|
|
|
('address', models.CharField(max_length=100)),
|
|
|
|
('zip_code', models.IntegerField(null=True, blank=True)),
|
2016-11-05 10:35:58 +00:00
|
|
|
('geom', models.PointField(srid=4326, geography=True)),
|
2015-06-19 15:46:03 +00:00
|
|
|
],
|
|
|
|
options={
|
|
|
|
'required_db_features': ['gis_enabled'],
|
|
|
|
},
|
|
|
|
bases=(models.Model,),
|
|
|
|
),
|
|
|
|
migrations.CreateModel(
|
|
|
|
name='Family',
|
|
|
|
fields=[
|
|
|
|
('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)),
|
|
|
|
('name', models.CharField(max_length=100, unique=True)),
|
|
|
|
],
|
|
|
|
options={
|
|
|
|
},
|
|
|
|
bases=(models.Model,),
|
|
|
|
),
|
|
|
|
migrations.AddField(
|
|
|
|
model_name='household',
|
|
|
|
name='family',
|
2015-07-22 14:43:21 +00:00
|
|
|
field=models.ForeignKey('gis_migrations.Family', models.SET_NULL, blank=True, null=True),
|
2015-06-19 15:46:03 +00:00
|
|
|
preserve_default=True,
|
|
|
|
)
|
|
|
|
]
|
2014-03-14 22:18:20 +00:00
|
|
|
|
2015-06-19 15:46:03 +00:00
|
|
|
if connection.features.gis_enabled and connection.features.supports_raster:
|
|
|
|
ops += [
|
2014-07-16 09:06:33 +00:00
|
|
|
migrations.CreateModel(
|
2015-06-19 15:46:03 +00:00
|
|
|
name='Heatmap',
|
2014-07-16 09:06:33 +00:00
|
|
|
fields=[
|
|
|
|
('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)),
|
|
|
|
('name', models.CharField(max_length=100, unique=True)),
|
2016-11-05 10:35:58 +00:00
|
|
|
('rast', models.fields.RasterField(srid=4326)),
|
2014-07-16 09:06:33 +00:00
|
|
|
],
|
|
|
|
options={
|
|
|
|
},
|
|
|
|
bases=(models.Model,),
|
|
|
|
),
|
2014-03-14 22:18:20 +00:00
|
|
|
]
|
2015-06-19 15:46:03 +00:00
|
|
|
|
|
|
|
|
|
|
|
class Migration(migrations.Migration):
|
|
|
|
"""
|
|
|
|
Used for gis-specific migration tests.
|
|
|
|
"""
|
|
|
|
operations = ops
|