Skip to content

Commit 422d5db

Browse files
committed
Add index for (source, path) to DataFile
1 parent e442bb9 commit 422d5db

File tree

2 files changed

+7
-0
lines changed

2 files changed

+7
-0
lines changed

netbox/core/migrations/0001_initial.py

+4
Original file line numberDiff line numberDiff line change
@@ -59,4 +59,8 @@ class Migration(migrations.Migration):
5959
model_name='datafile',
6060
constraint=models.UniqueConstraint(fields=('source', 'path'), name='core_datafile_unique_source_path'),
6161
),
62+
migrations.AddIndex(
63+
model_name='datafile',
64+
index=models.Index(fields=['source', 'path'], name='core_datafile_source_path'),
65+
),
6266
]

netbox/core/models/data.py

+3
Original file line numberDiff line numberDiff line change
@@ -273,6 +273,9 @@ class Meta:
273273
name='%(app_label)s_%(class)s_unique_source_path'
274274
),
275275
)
276+
indexes = [
277+
models.Index(fields=('source', 'path'), name='core_datafile_source_path'),
278+
]
276279

277280
def __str__(self):
278281
return self.path

0 commit comments

Comments
 (0)