Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

db

  • Loading branch information...
commit 2b99190f44f5272c571619d2a7d2388f312a0441 1 parent 6a2d498
@Davy-jones-Giant-squid authored
Showing with 41 additions and 28 deletions.
  1. +4 −4 chicagocrime/settings.py
  2. +37 −24 scrape_crime/migrations/0001_initial.py
View
8 chicagocrime/settings.py
@@ -24,11 +24,11 @@
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.postgresql_psycopg2',
- 'NAME': 'd3vqe1ltii1mef',
- 'HOST': 'ec2-54-227-251-13.compute-1.amazonaws.com',
+ 'NAME': 'dcjp0q81ol9dst',
+ 'HOST': 'ec2-107-20-245-109.compute-1.amazonaws.com',
'PORT': 5432,
- 'USER': 'lnoanlcuofumnv',
- 'PASSWORD': 'g642GfqoFHdk-vwVmawi5jbkx7'
+ 'USER': 'bvpmaqledcifeg',
+ 'PASSWORD': 'pXHnFHm-UZgweDnNjxnEi_GCbH'
}
}
View
61 scrape_crime/migrations/0001_initial.py
@@ -11,31 +11,23 @@ def forwards(self, orm):
# Adding model 'Crime'
db.create_table(u'scrape_crime_crime', (
(u'id', self.gf('django.db.models.fields.AutoField')(primary_key=True)),
- ('case_number', self.gf('django.db.models.fields.CharField')(max_length=255, null=True, blank='')),
+ ('case_number', self.gf('django.db.models.fields.CharField')(max_length=255, unique=True, null=True, blank='')),
('description', self.gf('django.db.models.fields.CharField')(max_length=255, null=True, blank='')),
('domestic', self.gf('django.db.models.fields.BooleanField')(default=False)),
('date', self.gf('django.db.models.fields.CharField')(max_length=255, null=True, blank='')),
('arrest', self.gf('django.db.models.fields.BooleanField')(default=False)),
('district', self.gf('django.db.models.fields.CharField')(max_length=255, null=True, blank='')),
- ('crime_spot', self.gf('django.db.models.fields.related.ForeignKey')(to=orm['scrape_crime.Crime_spot'], null=True, blank=True)),
+ ('neighborhood', self.gf('django.db.models.fields.related.ForeignKey')(to=orm['scrape_crime.Neighborhood'], null=True, blank=True)),
('primary_type', self.gf('django.db.models.fields.CharField')(max_length=255, blank='')),
('beat', self.gf('django.db.models.fields.CharField')(max_length=255, null=True, blank='')),
('ward', self.gf('django.db.models.fields.CharField')(max_length=255, null=True, blank='')),
('iucr', self.gf('django.db.models.fields.CharField')(max_length=255, null=True, blank='')),
('updated_on', self.gf('django.db.models.fields.CharField')(max_length=255, null=True, blank='')),
('fbi_code', self.gf('django.db.models.fields.CharField')(max_length=255, null=True, blank=True)),
- ))
- db.send_create_signal(u'scrape_crime', ['Crime'])
-
- # Adding model 'Crime_spot'
- db.create_table(u'scrape_crime_crime_spot', (
- (u'id', self.gf('django.db.models.fields.AutoField')(primary_key=True)),
- ('coordinates', self.gf('django.db.models.fields.related.ForeignKey')(to=orm['scrape_crime.Coordinates'], null=True, blank=True)),
- ('community_area', self.gf('django.db.models.fields.IntegerField')(default=False)),
- ('community_area_name', self.gf('django.db.models.fields.CharField')(max_length=255, null=True, blank='')),
+ ('crime_coordinates', self.gf('django.db.models.fields.related.ForeignKey')(to=orm['scrape_crime.Coordinates'], null=True, blank=True)),
('block', self.gf('django.db.models.fields.CharField')(max_length=255, null=True, blank='')),
))
- db.send_create_signal(u'scrape_crime', ['Crime_spot'])
+ db.send_create_signal(u'scrape_crime', ['Crime'])
# Adding model 'Coordinates'
db.create_table(u'scrape_crime_coordinates', (
@@ -45,17 +37,37 @@ def forwards(self, orm):
))
db.send_create_signal(u'scrape_crime', ['Coordinates'])
+ # Adding model 'Neighborhood'
+ db.create_table(u'scrape_crime_neighborhood', (
+ (u'id', self.gf('django.db.models.fields.AutoField')(primary_key=True)),
+ ('name', self.gf('django.db.models.fields.CharField')(default=False, unique=True, max_length=255)),
+ ('area_number', self.gf('django.db.models.fields.IntegerField')(default=False)),
+ ))
+ db.send_create_signal(u'scrape_crime', ['Neighborhood'])
+
+ # Adding M2M table for field coordinates on 'Neighborhood'
+ m2m_table_name = db.shorten_name(u'scrape_crime_neighborhood_coordinates')
+ db.create_table(m2m_table_name, (
+ ('id', models.AutoField(verbose_name='ID', primary_key=True, auto_created=True)),
+ ('neighborhood', models.ForeignKey(orm[u'scrape_crime.neighborhood'], null=False)),
+ ('coordinates', models.ForeignKey(orm[u'scrape_crime.coordinates'], null=False))
+ ))
+ db.create_unique(m2m_table_name, ['neighborhood_id', 'coordinates_id'])
+
def backwards(self, orm):
# Deleting model 'Crime'
db.delete_table(u'scrape_crime_crime')
- # Deleting model 'Crime_spot'
- db.delete_table(u'scrape_crime_crime_spot')
-
# Deleting model 'Coordinates'
db.delete_table(u'scrape_crime_coordinates')
+ # Deleting model 'Neighborhood'
+ db.delete_table(u'scrape_crime_neighborhood')
+
+ # Removing M2M table for field coordinates on 'Neighborhood'
+ db.delete_table(db.shorten_name(u'scrape_crime_neighborhood_coordinates'))
+
models = {
u'scrape_crime.coordinates': {
@@ -68,8 +80,9 @@ def backwards(self, orm):
'Meta': {'ordering': "['description']", 'object_name': 'Crime'},
'arrest': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
'beat': ('django.db.models.fields.CharField', [], {'max_length': '255', 'null': 'True', 'blank': "''"}),
- 'case_number': ('django.db.models.fields.CharField', [], {'max_length': '255', 'null': 'True', 'blank': "''"}),
- 'crime_spot': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['scrape_crime.Crime_spot']", 'null': 'True', 'blank': 'True'}),
+ 'block': ('django.db.models.fields.CharField', [], {'max_length': '255', 'null': 'True', 'blank': "''"}),
+ 'case_number': ('django.db.models.fields.CharField', [], {'max_length': '255', 'unique': 'True', 'null': 'True', 'blank': "''"}),
+ 'crime_coordinates': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['scrape_crime.Coordinates']", 'null': 'True', 'blank': 'True'}),
'date': ('django.db.models.fields.CharField', [], {'max_length': '255', 'null': 'True', 'blank': "''"}),
'description': ('django.db.models.fields.CharField', [], {'max_length': '255', 'null': 'True', 'blank': "''"}),
'district': ('django.db.models.fields.CharField', [], {'max_length': '255', 'null': 'True', 'blank': "''"}),
@@ -77,17 +90,17 @@ def backwards(self, orm):
'fbi_code': ('django.db.models.fields.CharField', [], {'max_length': '255', 'null': 'True', 'blank': 'True'}),
u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'iucr': ('django.db.models.fields.CharField', [], {'max_length': '255', 'null': 'True', 'blank': "''"}),
+ 'neighborhood': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['scrape_crime.Neighborhood']", 'null': 'True', 'blank': 'True'}),
'primary_type': ('django.db.models.fields.CharField', [], {'max_length': '255', 'blank': "''"}),
'updated_on': ('django.db.models.fields.CharField', [], {'max_length': '255', 'null': 'True', 'blank': "''"}),
'ward': ('django.db.models.fields.CharField', [], {'max_length': '255', 'null': 'True', 'blank': "''"})
},
- u'scrape_crime.crime_spot': {
- 'Meta': {'object_name': 'Crime_spot'},
- 'block': ('django.db.models.fields.CharField', [], {'max_length': '255', 'null': 'True', 'blank': "''"}),
- 'community_area': ('django.db.models.fields.IntegerField', [], {'default': 'False'}),
- 'community_area_name': ('django.db.models.fields.CharField', [], {'max_length': '255', 'null': 'True', 'blank': "''"}),
- 'coordinates': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['scrape_crime.Coordinates']", 'null': 'True', 'blank': 'True'}),
- u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'})
+ u'scrape_crime.neighborhood': {
+ 'Meta': {'object_name': 'Neighborhood'},
+ 'area_number': ('django.db.models.fields.IntegerField', [], {'default': 'False'}),
+ 'coordinates': ('django.db.models.fields.related.ManyToManyField', [], {'to': u"orm['scrape_crime.Coordinates']", 'symmetrical': 'False'}),
+ u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+ 'name': ('django.db.models.fields.CharField', [], {'default': 'False', 'unique': 'True', 'max_length': '255'})
}
}
Please sign in to comment.
Something went wrong with that request. Please try again.