Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add index to hostname #3800

Open
wants to merge 2 commits into
base: ng
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions src/ralph/assets/migrations/0035_auto_20240425_1059.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals

from django.db import migrations, models
import ralph.lib.mixins.fields


class Migration(migrations.Migration):

dependencies = [
('assets', '0034_auto_20240304_1511'),
]

operations = [
migrations.AlterField(
model_name='asset',
name='hostname',
field=ralph.lib.mixins.fields.NullableCharFieldWithAutoStrip(verbose_name='hostname', max_length=255, blank=True, null=True, db_index=True, default=None),
),
]
1 change: 1 addition & 0 deletions src/ralph/assets/models/assets.py
Original file line number Diff line number Diff line change
Expand Up @@ -368,6 +368,7 @@ class Asset(AdminAbsoluteUrlMixin, PriceMixin, BaseObject):
max_length=255,
null=True,
verbose_name=_('hostname'), # TODO: unique
db_index=True,
)
sn = NullableCharField(
blank=True,
Expand Down
19 changes: 19 additions & 0 deletions src/ralph/virtual/migrations/0014_auto_20240425_1059.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals

from django.db import migrations, models


class Migration(migrations.Migration):

dependencies = [
('virtual', '0013_auto_20190625_1239'),
]

operations = [
migrations.AlterField(
model_name='cloudhost',
name='hostname',
field=models.CharField(verbose_name='hostname', max_length=255, db_index=True),
),
]
3 changes: 2 additions & 1 deletion src/ralph/virtual/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,8 @@ def save(self, *args, **kwargs):
)
hostname = models.CharField(
verbose_name=_('hostname'),
max_length=255
max_length=255,
db_index=True,
)
hypervisor = models.ForeignKey(DataCenterAsset, blank=True, null=True)
image_name = models.CharField(max_length=255, null=True, blank=True)
Expand Down
Loading