From 24f0cf7ec7fb6a3042197789754454badfedf517 Mon Sep 17 00:00:00 2001 From: Wille Marcel Date: Tue, 20 Sep 2022 16:20:45 -0300 Subject: [PATCH] Remove most indexes from changesets table (#621) --- .../migrations/0057_auto_20220920_1423.py | 73 +++++++++++++++++++ osmchadjango/changeset/models.py | 26 +++---- 2 files changed, 86 insertions(+), 13 deletions(-) create mode 100644 osmchadjango/changeset/migrations/0057_auto_20220920_1423.py diff --git a/osmchadjango/changeset/migrations/0057_auto_20220920_1423.py b/osmchadjango/changeset/migrations/0057_auto_20220920_1423.py new file mode 100644 index 00000000..a8d587cd --- /dev/null +++ b/osmchadjango/changeset/migrations/0057_auto_20220920_1423.py @@ -0,0 +1,73 @@ +# Generated by Django 2.2.28 on 2022-09-20 14:23 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('changeset', '0056_auto_20220429_1305'), + ] + + operations = [ + migrations.AlterField( + model_name='changeset', + name='checked', + field=models.BooleanField(default=False), + ), + migrations.AlterField( + model_name='changeset', + name='comment', + field=models.CharField(blank=True, max_length=1000, null=True), + ), + migrations.AlterField( + model_name='changeset', + name='comments_count', + field=models.IntegerField(default=0, null=True), + ), + migrations.AlterField( + model_name='changeset', + name='create', + field=models.IntegerField(null=True), + ), + migrations.AlterField( + model_name='changeset', + name='delete', + field=models.IntegerField(null=True), + ), + migrations.AlterField( + model_name='changeset', + name='editor', + field=models.CharField(blank=True, max_length=255, null=True), + ), + migrations.AlterField( + model_name='changeset', + name='harmful', + field=models.NullBooleanField(), + ), + migrations.AlterField( + model_name='changeset', + name='imagery_used', + field=models.CharField(blank=True, max_length=1000, null=True), + ), + migrations.AlterField( + model_name='changeset', + name='is_suspect', + field=models.BooleanField(), + ), + migrations.AlterField( + model_name='changeset', + name='modify', + field=models.IntegerField(null=True), + ), + migrations.AlterField( + model_name='changeset', + name='source', + field=models.CharField(blank=True, max_length=1000, null=True), + ), + migrations.AlterField( + model_name='changeset', + name='uid', + field=models.CharField(blank=True, max_length=255, null=True, verbose_name='User ID'), + ), + ] diff --git a/osmchadjango/changeset/models.py b/osmchadjango/changeset/models.py index d8ff1cd1..be939621 100644 --- a/osmchadjango/changeset/models.py +++ b/osmchadjango/changeset/models.py @@ -60,29 +60,29 @@ class Meta: class Changeset(models.Model): user = models.CharField(max_length=1000, db_index=True) - uid = models.CharField(_('User ID'), max_length=255, blank=True, null=True, db_index=True) - editor = models.CharField(max_length=255, blank=True, null=True, db_index=True) + uid = models.CharField(_('User ID'), max_length=255, blank=True, null=True) + editor = models.CharField(max_length=255, blank=True, null=True) powerfull_editor = models.BooleanField(_('Powerfull Editor'), default=False) - comment = models.CharField(max_length=1000, blank=True, null=True, db_index=True) - comments_count = models.IntegerField(null=True, db_index=True, default=0) - source = models.CharField(max_length=1000, blank=True, null=True, db_index=True) - imagery_used = models.CharField(max_length=1000, blank=True, null=True, db_index=True) + comment = models.CharField(max_length=1000, blank=True, null=True) + comments_count = models.IntegerField(null=True, default=0) + source = models.CharField(max_length=1000, blank=True, null=True) + imagery_used = models.CharField(max_length=1000, blank=True, null=True) date = models.DateTimeField(null=True, db_index=True) reasons = models.ManyToManyField(SuspicionReasons, related_name='changesets') new_features = JSONField(default=list) reviewed_features = JSONField(default=list) tag_changes = JSONField(default=dict) - create = models.IntegerField(db_index=True, null=True) - modify = models.IntegerField(db_index=True, null=True) - delete = models.IntegerField(db_index=True, null=True) + create = models.IntegerField(null=True) + modify = models.IntegerField(null=True) + delete = models.IntegerField(null=True) bbox = models.PolygonField(null=True) area = models.FloatField(blank=True, null=True) - is_suspect = models.BooleanField(db_index=True) - harmful = models.NullBooleanField(db_index=True) + is_suspect = models.BooleanField() + harmful = models.NullBooleanField() tags = models.ManyToManyField(Tag, related_name='changesets') - checked = models.BooleanField(default=False, db_index=True) + checked = models.BooleanField(default=False) check_user = models.ForeignKey( - User, on_delete=models.SET_NULL, null=True, blank=True, db_index=True + User, on_delete=models.SET_NULL, null=True, blank=True ) check_date = models.DateTimeField(null=True, blank=True) metadata = JSONField(default=dict)