More database idizes

This commit is contained in:
Sebastian Lohff 2015-08-13 12:30:35 +02:00
parent 902bc6be3d
commit 15bfd12b5c
1 changed files with 9 additions and 2 deletions

View File

@ -74,14 +74,17 @@ class CrawlLog(models.Model):
class AS(models.Model): class AS(models.Model):
# asno # asno
crawl = models.ForeignKey(CrawlRun) crawl = models.ForeignKey(CrawlRun)
number = models.IntegerField() number = models.IntegerField(db_index=True)
directlyCrawled = models.BooleanField(default=False) directlyCrawled = models.BooleanField(default=False)
online = models.BooleanField(default=True) online = models.BooleanField(default=True, db_index=True)
lastSeen = models.ForeignKey(CrawlRun, blank=True, null=True, default=None, related_name='as_lastseen') lastSeen = models.ForeignKey(CrawlRun, blank=True, null=True, default=None, related_name='as_lastseen')
class Meta: class Meta:
unique_together = (('crawl', 'number'),) unique_together = (('crawl', 'number'),)
index_together = (
('crawl', 'number'),
)
def __unicode__(self): def __unicode__(self):
return u"AS %s (crawl %d)" % (self.number, self.crawl.pk) return u"AS %s (crawl %d)" % (self.number, self.crawl.pk)
@ -136,6 +139,10 @@ class Peering(models.Model):
(DIRECT, 'Direct Connection'), (DIRECT, 'Direct Connection'),
) )
index_together = (
('as1', 'as2'),
)
as1 = models.ForeignKey(AS, related_name='peering1') as1 = models.ForeignKey(AS, related_name='peering1')
as2 = models.ForeignKey(AS, related_name='peering2') as2 = models.ForeignKey(AS, related_name='peering2')
origin = models.CharField(max_length=10, choices=ORIGIN) origin = models.CharField(max_length=10, choices=ORIGIN)