Skip to content

Commit 9364ebe

Browse files
authored
feat(stacktrace-link): Add RepositoryProjectPathConfig table (#21331)
* feat(stacktrace-link): Add RepositoryProjectPathConfig table * add org_integration * stack_root and source_root
1 parent 97f47a7 commit 9364ebe

File tree

3 files changed

+74
-1
lines changed

3 files changed

+74
-1
lines changed

migrations_lockfile.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ auth: 0008_alter_user_username_max_length
1010
contenttypes: 0002_remove_content_type_name
1111
jira_ac: 0001_initial
1212
nodestore: 0001_initial
13-
sentry: 0112_groupinboxmodel
13+
sentry: 0113_add_repositoryprojectpathconfig
1414
sessions: 0001_initial
1515
sites: 0002_alter_domain_unique
1616
social_auth: 0001_initial
Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
# -*- coding: utf-8 -*-
2+
# Generated by Django 1.11.29 on 2020-10-15 17:38
3+
from __future__ import unicode_literals
4+
5+
from django.db import migrations, models
6+
import django.db.models.deletion
7+
import django.utils.timezone
8+
import sentry.db.models.fields.bounded
9+
import sentry.db.models.fields.foreignkey
10+
11+
12+
class Migration(migrations.Migration):
13+
# This flag is used to mark that a migration shouldn't be automatically run in
14+
# production. We set this to True for operations that we think are risky and want
15+
# someone from ops to run manually and monitor.
16+
# General advice is that if in doubt, mark your migration as `is_dangerous`.
17+
# Some things you should always mark as dangerous:
18+
# - Large data migrations. Typically we want these to be run manually by ops so that
19+
# they can be monitored. Since data migrations will now hold a transaction open
20+
# this is even more important.
21+
# - Adding columns to highly active tables, even ones that are NULL.
22+
is_dangerous = False
23+
24+
# This flag is used to decide whether to run this migration in a transaction or not.
25+
# By default we prefer to run in a transaction, but for migrations where you want
26+
# to `CREATE INDEX CONCURRENTLY` this needs to be set to False. Typically you'll
27+
# want to create an index concurrently when adding one to an existing table.
28+
atomic = True
29+
30+
31+
dependencies = [
32+
('sentry', '0112_groupinboxmodel'),
33+
]
34+
35+
operations = [
36+
migrations.CreateModel(
37+
name='RepositoryProjectPathConfig',
38+
fields=[
39+
('id', sentry.db.models.fields.bounded.BoundedBigAutoField(primary_key=True, serialize=False)),
40+
('date_updated', models.DateTimeField(default=django.utils.timezone.now)),
41+
('date_added', models.DateTimeField(default=django.utils.timezone.now, null=True)),
42+
('stack_root', models.TextField()),
43+
('source_root', models.TextField()),
44+
('default_branch', models.TextField(null=True)),
45+
('organization_integration', sentry.db.models.fields.foreignkey.FlexibleForeignKey(on_delete=django.db.models.deletion.CASCADE, to='sentry.OrganizationIntegration')),
46+
('project', sentry.db.models.fields.foreignkey.FlexibleForeignKey(db_constraint=False, on_delete=django.db.models.deletion.CASCADE, to='sentry.Project')),
47+
('repository', sentry.db.models.fields.foreignkey.FlexibleForeignKey(on_delete=django.db.models.deletion.CASCADE, to='sentry.Repository')),
48+
],
49+
options={
50+
'db_table': 'sentry_repositoryprojectpathconfig',
51+
},
52+
),
53+
migrations.AlterUniqueTogether(
54+
name='repositoryprojectpathconfig',
55+
unique_together=set([('project', 'stack_root')]),
56+
),
57+
]

src/sentry/models/integration.py

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,22 @@ class Meta:
4848
unique_together = (("organization_integration_id", "external_id"),)
4949

5050

51+
class RepositoryProjectPathConfig(DefaultFieldsModel):
52+
__core__ = False
53+
54+
repository = FlexibleForeignKey("sentry.Repository")
55+
project = FlexibleForeignKey("sentry.Project", db_constraint=False)
56+
organization_integration = FlexibleForeignKey("sentry.OrganizationIntegration")
57+
stack_root = models.TextField()
58+
source_root = models.TextField()
59+
default_branch = models.TextField(null=True)
60+
61+
class Meta:
62+
app_label = "sentry"
63+
db_table = "sentry_repositoryprojectpathconfig"
64+
unique_together = (("project", "stack_root"),)
65+
66+
5167
class OrganizationIntegration(DefaultFieldsModel):
5268
__core__ = False
5369

0 commit comments

Comments
 (0)