mirror of
https://gitlab.science.ru.nl/technicie/MarietjeDjango.git
synced 2025-12-10 00:32:20 +01:00
Add indices on search fields
This commit is contained in:
33
marietje/songs/migrations/0003_search_index.py
Normal file
33
marietje/songs/migrations/0003_search_index.py
Normal file
@ -0,0 +1,33 @@
|
|||||||
|
# Generated by Django 2.1.2 on 2018-10-26 14:35
|
||||||
|
|
||||||
|
from django.db import migrations, models
|
||||||
|
|
||||||
|
|
||||||
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
|
dependencies = [
|
||||||
|
('songs', '0002_replaygain'),
|
||||||
|
]
|
||||||
|
|
||||||
|
operations = [
|
||||||
|
migrations.AlterField(
|
||||||
|
model_name='song',
|
||||||
|
name='artist',
|
||||||
|
field=models.CharField(db_index=True, help_text='track artist', max_length=200),
|
||||||
|
),
|
||||||
|
migrations.AlterField(
|
||||||
|
model_name='song',
|
||||||
|
name='deleted',
|
||||||
|
field=models.BooleanField(db_index=True, default=False, help_text='hide this song from the search listings', verbose_name='unlisted'),
|
||||||
|
),
|
||||||
|
migrations.AlterField(
|
||||||
|
model_name='song',
|
||||||
|
name='hash',
|
||||||
|
field=models.CharField(help_text="track file's SHA256 hash", max_length=64),
|
||||||
|
),
|
||||||
|
migrations.AlterField(
|
||||||
|
model_name='song',
|
||||||
|
name='title',
|
||||||
|
field=models.CharField(db_index=True, help_text='track title', max_length=200),
|
||||||
|
),
|
||||||
|
]
|
||||||
@ -7,18 +7,33 @@ class Song(models.Model):
|
|||||||
settings.AUTH_USER_MODEL,
|
settings.AUTH_USER_MODEL,
|
||||||
on_delete=models.SET_NULL,
|
on_delete=models.SET_NULL,
|
||||||
blank=True,
|
blank=True,
|
||||||
null=True
|
null=True,
|
||||||
)
|
db_index=True)
|
||||||
artist = models.TextField()
|
artist = models.CharField(
|
||||||
title = models.TextField()
|
max_length=200, db_index=True, help_text='track artist')
|
||||||
hash = models.TextField()
|
title = models.CharField(
|
||||||
duration = models.IntegerField(help_text="track duration in seconds")
|
max_length=200, db_index=True, help_text='track title')
|
||||||
rg_gain = models.DecimalField(max_digits=9, decimal_places=6,
|
hash = models.CharField(
|
||||||
blank=True, null=True, help_text="replaygain gain level")
|
max_length=64, help_text="track file's SHA256 hash")
|
||||||
rg_peak = models.DecimalField(max_digits=9, decimal_places=6,
|
duration = models.IntegerField(help_text='track duration in seconds')
|
||||||
blank=True, null=True, help_text="replaygain peak level")
|
rg_gain = models.DecimalField(
|
||||||
|
max_digits=9,
|
||||||
|
decimal_places=6,
|
||||||
|
blank=True,
|
||||||
|
null=True,
|
||||||
|
help_text='replaygain gain level')
|
||||||
|
rg_peak = models.DecimalField(
|
||||||
|
max_digits=9,
|
||||||
|
decimal_places=6,
|
||||||
|
blank=True,
|
||||||
|
null=True,
|
||||||
|
help_text='replaygain peak level')
|
||||||
old_id = models.TextField(blank=True, null=True, default=None)
|
old_id = models.TextField(blank=True, null=True, default=None)
|
||||||
deleted = models.BooleanField(default=False)
|
deleted = models.BooleanField(
|
||||||
|
verbose_name='unlisted',
|
||||||
|
default=False,
|
||||||
|
db_index=True,
|
||||||
|
help_text='hide this song from the search listings')
|
||||||
|
|
||||||
def __str__(self):
|
def __str__(self):
|
||||||
return self.artist + ' - ' + self.title
|
return self.artist + ' - ' + self.title
|
||||||
|
|||||||
Reference in New Issue
Block a user