Skip to content

Commit 1e628cd

Browse files
author
Riccardo Busetti
authored
feat(sourcemaps): Add index on date_added (#46372)
1 parent 9af2033 commit 1e628cd

File tree

3 files changed

+34
-2
lines changed

3 files changed

+34
-2
lines changed

migrations_lockfile.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,5 +6,5 @@ To resolve this, rebase against latest master and regenerate your migration. Thi
66
will then be regenerated, and you should be able to merge without conflicts.
77

88
nodestore: 0002_nodestore_no_dictfield
9-
sentry: 0394_set_none_date_uploaded_to_date_added
9+
sentry: 0395_add_index_to_date_added
1010
social_auth: 0001_initial
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
# Generated by Django 2.2.28 on 2023-03-27 11:56
2+
3+
import django.utils.timezone
4+
from django.db import migrations, models
5+
6+
from sentry.new_migrations.migrations import CheckedMigration
7+
8+
9+
class Migration(CheckedMigration):
10+
# This flag is used to mark that a migration shouldn't be automatically run in production. For
11+
# the most part, this should only be used for operations where it's safe to run the migration
12+
# after your code has deployed. So this should not be used for most operations that alter the
13+
# schema of a table.
14+
# Here are some things that make sense to mark as dangerous:
15+
# - Large data migrations. Typically we want these to be run manually by ops so that they can
16+
# be monitored and not block the deploy for a long period of time while they run.
17+
# - Adding indexes to large tables. Since this can take a long time, we'd generally prefer to
18+
# have ops run this and not block the deploy. Note that while adding an index is a schema
19+
# change, it's completely safe to run the operation after the code has deployed.
20+
is_dangerous = False
21+
22+
dependencies = [
23+
("sentry", "0394_set_none_date_uploaded_to_date_added"),
24+
]
25+
26+
operations = [
27+
migrations.AlterField(
28+
model_name="artifactbundle",
29+
name="date_added",
30+
field=models.DateTimeField(db_index=True, default=django.utils.timezone.now),
31+
),
32+
]

src/sentry/models/artifactbundle.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ class ArtifactBundle(Model):
5252
bundle_id = models.UUIDField(default=NULL_UUID)
5353
file = FlexibleForeignKey("sentry.File")
5454
artifact_count = BoundedPositiveIntegerField()
55-
date_added = models.DateTimeField(default=timezone.now)
55+
date_added = models.DateTimeField(default=timezone.now, db_index=True)
5656
# This field represents the date of the upload that we show in the UI.
5757
date_uploaded = models.DateTimeField(default=timezone.now)
5858

0 commit comments

Comments
 (0)