Skip to content
This repository was archived by the owner on May 5, 2025. It is now read-only.
Merged
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
46 changes: 46 additions & 0 deletions shared/django_apps/core/migrations/0064_missing_indices.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
# Generated by Django 4.2.16 on 2025-01-27 13:18

import django.db.models.deletion
from django.contrib.postgres.operations import AddIndexConcurrently
from django.db import migrations, models


class Migration(migrations.Migration):
atomic = False

dependencies = [
("core", "0063_increment_version"),
]

operations = [
migrations.AlterField(
model_name="repository",
name="fork",
field=models.ForeignKey(
blank=True,
db_column="forkid",
null=True,
on_delete=django.db.models.deletion.SET_NULL,
to="core.repository",
),
),
migrations.AlterField(
model_name="repository",
name="languages",
field=django.contrib.postgres.fields.ArrayField(
base_field=models.CharField(),
blank=True,
default=list,
null=True,
size=None,
),
),
AddIndexConcurrently(
model_name="commit",
index=models.Index(fields=["author"], name="commits_author_cd2f50_idx"),
),
AddIndexConcurrently(
model_name="repository",
index=models.Index(fields=["fork"], name="repos_forkid_4cd440_idx"),
),
]
6 changes: 4 additions & 2 deletions shared/django_apps/core/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -108,12 +108,12 @@ class Languages(models.TextChoices):
language = models.TextField(
null=True, blank=True, choices=Languages.choices
) # Really an ENUM in db
languages = ArrayField(models.CharField(), default=[], blank=True, null=True)
languages = ArrayField(models.CharField(), default=list, blank=True, null=True)
languages_last_updated = DateTimeWithoutTZField(null=True, blank=True)
fork = models.ForeignKey(
"core.Repository",
db_column="forkid",
on_delete=models.DO_NOTHING,
on_delete=models.SET_NULL,
null=True,
blank=True,
)
Expand Down Expand Up @@ -149,6 +149,7 @@ class Meta:
app_label = CORE_APP_LABEL
ordering = ["-repoid"]
indexes = [
models.Index(fields=["fork"]),
models.Index(
fields=["service_id", "author"],
name="repos_service_id_author",
Expand Down Expand Up @@ -287,6 +288,7 @@ class Meta:
)
]
indexes = [
models.Index(fields=["author"]),
models.Index(
fields=["repository", "-timestamp"],
name="commits_repoid_timestamp_desc",
Expand Down
Loading