2016-11-05 18:35:58 +08:00
|
|
|
from django.contrib.gis.db import models
|
|
|
|
from django.db import connection, migrations
|
2015-04-05 00:09:46 +08:00
|
|
|
|
2015-06-19 23:46:03 +08: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 18:35:58 +08:00
|
|
|
('geom', models.MultiPolygonField(srid=4326)),
|
2015-06-19 23:46:03 +08:00
|
|
|
],
|
|
|
|
options={
|
|
|
|
},
|
|
|
|
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 22:43:21 +08:00
|
|
|
('neighborhood', models.ForeignKey(
|
|
|
|
'gis_migrations.Neighborhood',
|
|
|
|
models.SET_NULL,
|
|
|
|
to_field='id',
|
|
|
|
null=True,
|
|
|
|
)),
|
2015-06-19 23:46:03 +08:00
|
|
|
('address', models.CharField(max_length=100)),
|
|
|
|
('zip_code', models.IntegerField(null=True, blank=True)),
|
2016-11-05 18:35:58 +08:00
|
|
|
('geom', models.PointField(srid=4326, geography=True)),
|
2015-06-19 23:46:03 +08:00
|
|
|
],
|
|
|
|
options={
|
|
|
|
},
|
|
|
|
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 22:43:21 +08:00
|
|
|
field=models.ForeignKey('gis_migrations.Family', models.SET_NULL, blank=True, null=True),
|
2015-06-19 23:46:03 +08:00
|
|
|
preserve_default=True,
|
|
|
|
)
|
|
|
|
]
|
2014-03-15 06:18:20 +08:00
|
|
|
|
2017-05-04 22:14:35 +08:00
|
|
|
if connection.features.supports_raster:
|
2015-06-19 23:46:03 +08:00
|
|
|
ops += [
|
2014-07-16 17:06:33 +08:00
|
|
|
migrations.CreateModel(
|
2015-06-19 23:46:03 +08:00
|
|
|
name='Heatmap',
|
2014-07-16 17:06:33 +08: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 18:35:58 +08:00
|
|
|
('rast', models.fields.RasterField(srid=4326)),
|
2014-07-16 17:06:33 +08:00
|
|
|
],
|
|
|
|
options={
|
|
|
|
},
|
|
|
|
bases=(models.Model,),
|
|
|
|
),
|
2014-03-15 06:18:20 +08:00
|
|
|
]
|
2015-06-19 23:46:03 +08:00
|
|
|
|
|
|
|
|
|
|
|
class Migration(migrations.Migration):
|
|
|
|
"""
|
|
|
|
Used for gis-specific migration tests.
|
|
|
|
"""
|
|
|
|
operations = ops
|