Skip to content
This repository has been archived by the owner on May 14, 2018. It is now read-only.

Commit

Permalink
Merge pull request #23 from cfpb/add-index-together
Browse files Browse the repository at this point in the history
Add additional index to CachedGeoData
  • Loading branch information
chosak authored Aug 23, 2017
2 parents 7bffac4 + eaa9341 commit 4617146
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 2 deletions.
18 changes: 18 additions & 0 deletions hud_api_replace/migrations/0002_add_index_together.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals

from django.db import migrations, models


class Migration(migrations.Migration):

dependencies = [
('hud_api_replace', '0001_initial'),
]

operations = [
migrations.AlterIndexTogether(
name='cachedgeodata',
index_together=set([('key', 'expires')]),
),
]
7 changes: 5 additions & 2 deletions hud_api_replace/models.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
from django.db import models
from django.utils.encoding import python_2_unicode_compatible

import datetime


class CachedGeodata(models.Model):
"""Model to save geocoding information locally."""
Expand All @@ -11,6 +9,11 @@ class CachedGeodata(models.Model):
lon = models.FloatField('Longitude', null=True)
expires = models.PositiveIntegerField(null=True)

class Meta:
index_together = (
('key', 'expires'),
)


@python_2_unicode_compatible
class CounselingAgency(models.Model):
Expand Down

0 comments on commit 4617146

Please sign in to comment.