added some unique constraints and indexes
This commit is contained in:
parent
6736c92b7a
commit
72cdbf7bcf
|
@ -11,7 +11,7 @@ class State(models.Model):
|
|||
|
||||
class Station(models.Model):
|
||||
data_id = models.IntegerField() #id in the source data
|
||||
code = models.CharField(max_length=10)
|
||||
code = models.CharField(max_length=10, unique=True, db_index=True)
|
||||
name = models.CharField(max_length=255)
|
||||
zone = models.CharField(max_length=10)
|
||||
state = models.ForeignKey(State)
|
||||
|
@ -25,8 +25,8 @@ class Station(models.Model):
|
|||
class Train(models.Model):
|
||||
data_id = models.IntegerField()
|
||||
name = models.CharField(max_length=255)
|
||||
number = models.CharField(max_length=12)
|
||||
return_train = models.CharField(max_length=12)
|
||||
number = models.CharField(max_length=12, unique=True, db_index=True)
|
||||
return_train = models.CharField(max_length=12, unique=True, db_index=True)
|
||||
duration_h = models.IntegerField()
|
||||
duration_m = models.IntegerField()
|
||||
zone = models.CharField(max_length=10)
|
||||
|
|
Loading…
Reference in New Issue
Block a user