Browse Source

More database idizes

master
Sebastian Lohff 7 years ago
parent
commit
15bfd12b5c
  1. 11
      bgpdata/models.py

11
bgpdata/models.py

@ -74,14 +74,17 @@ class CrawlLog(models.Model): @@ -74,14 +74,17 @@ class CrawlLog(models.Model):
class AS(models.Model):
# asno
crawl = models.ForeignKey(CrawlRun)
number = models.IntegerField()
number = models.IntegerField(db_index=True)
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')
class Meta:
unique_together = (('crawl', 'number'),)
index_together = (
('crawl', 'number'),
)
def __unicode__(self):
return u"AS %s (crawl %d)" % (self.number, self.crawl.pk)
@ -136,6 +139,10 @@ class Peering(models.Model): @@ -136,6 +139,10 @@ class Peering(models.Model):
(DIRECT, 'Direct Connection'),
)
index_together = (
('as1', 'as2'),
)
as1 = models.ForeignKey(AS, related_name='peering1')
as2 = models.ForeignKey(AS, related_name='peering2')
origin = models.CharField(max_length=10, choices=ORIGIN)

Loading…
Cancel
Save