Skip to content

Commit d97a030

Browse files
committed
Add index to hostname
1 parent 541c25d commit d97a030

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed

src/ralph/assets/models/assets.py

+1
Original file line numberDiff line numberDiff line change
@@ -368,6 +368,7 @@ class Asset(AdminAbsoluteUrlMixin, PriceMixin, BaseObject):
368368
max_length=255,
369369
null=True,
370370
verbose_name=_('hostname'), # TODO: unique
371+
db_index=True,
371372
)
372373
sn = NullableCharField(
373374
blank=True,

src/ralph/virtual/models.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -214,7 +214,8 @@ def save(self, *args, **kwargs):
214214
)
215215
hostname = models.CharField(
216216
verbose_name=_('hostname'),
217-
max_length=255
217+
max_length=255,
218+
db_index=True,
218219
)
219220
hypervisor = models.ForeignKey(DataCenterAsset, blank=True, null=True)
220221
image_name = models.CharField(max_length=255, null=True, blank=True)

0 commit comments

Comments
 (0)