-
-
Notifications
You must be signed in to change notification settings - Fork 4.5k
feat(stacktrace-link): Add RepositoryProjectPathConfig table #21331
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,57 @@ | ||
| # -*- coding: utf-8 -*- | ||
| # Generated by Django 1.11.29 on 2020-10-15 17:38 | ||
| from __future__ import unicode_literals | ||
|
|
||
| from django.db import migrations, models | ||
| import django.db.models.deletion | ||
| import django.utils.timezone | ||
| import sentry.db.models.fields.bounded | ||
| import sentry.db.models.fields.foreignkey | ||
|
|
||
|
|
||
| class Migration(migrations.Migration): | ||
| # This flag is used to mark that a migration shouldn't be automatically run in | ||
| # production. We set this to True for operations that we think are risky and want | ||
| # someone from ops to run manually and monitor. | ||
| # General advice is that if in doubt, mark your migration as `is_dangerous`. | ||
| # Some things you should always mark as dangerous: | ||
| # - Large data migrations. Typically we want these to be run manually by ops so that | ||
| # they can be monitored. Since data migrations will now hold a transaction open | ||
| # this is even more important. | ||
| # - Adding columns to highly active tables, even ones that are NULL. | ||
| is_dangerous = False | ||
|
|
||
| # This flag is used to decide whether to run this migration in a transaction or not. | ||
| # By default we prefer to run in a transaction, but for migrations where you want | ||
| # to `CREATE INDEX CONCURRENTLY` this needs to be set to False. Typically you'll | ||
| # want to create an index concurrently when adding one to an existing table. | ||
| atomic = True | ||
|
|
||
|
|
||
| dependencies = [ | ||
| ('sentry', '0112_groupinboxmodel'), | ||
| ] | ||
|
|
||
| operations = [ | ||
| migrations.CreateModel( | ||
| name='RepositoryProjectPathConfig', | ||
| fields=[ | ||
| ('id', sentry.db.models.fields.bounded.BoundedBigAutoField(primary_key=True, serialize=False)), | ||
| ('date_updated', models.DateTimeField(default=django.utils.timezone.now)), | ||
| ('date_added', models.DateTimeField(default=django.utils.timezone.now, null=True)), | ||
| ('stack_root', models.TextField()), | ||
| ('source_root', models.TextField()), | ||
| ('default_branch', models.TextField(null=True)), | ||
| ('organization_integration', sentry.db.models.fields.foreignkey.FlexibleForeignKey(on_delete=django.db.models.deletion.CASCADE, to='sentry.OrganizationIntegration')), | ||
| ('project', sentry.db.models.fields.foreignkey.FlexibleForeignKey(db_constraint=False, on_delete=django.db.models.deletion.CASCADE, to='sentry.Project')), | ||
| ('repository', sentry.db.models.fields.foreignkey.FlexibleForeignKey(on_delete=django.db.models.deletion.CASCADE, to='sentry.Repository')), | ||
| ], | ||
| options={ | ||
| 'db_table': 'sentry_repositoryprojectpathconfig', | ||
| }, | ||
| ), | ||
| migrations.AlterUniqueTogether( | ||
| name='repositoryprojectpathconfig', | ||
| unique_together=set([('project', 'stack_root')]), | ||
| ), | ||
| ] |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -48,6 +48,22 @@ class Meta: | |
| unique_together = (("organization_integration_id", "external_id"),) | ||
|
|
||
|
|
||
| class RepositoryProjectPathConfig(DefaultFieldsModel): | ||
| __core__ = False | ||
|
|
||
| repository = FlexibleForeignKey("sentry.Repository") | ||
| project = FlexibleForeignKey("sentry.Project", db_constraint=False) | ||
|
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @wedamija I wasn't sure if I should have added
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. You can, it's probably fine either way. That's really just an optimisation, and this table probably won't be large enough or high volume enough for it to be important. |
||
| organization_integration = FlexibleForeignKey("sentry.OrganizationIntegration") | ||
| stack_root = models.TextField() | ||
| source_root = models.TextField() | ||
| default_branch = models.TextField(null=True) | ||
|
|
||
| class Meta: | ||
| app_label = "sentry" | ||
| db_table = "sentry_repositoryprojectpathconfig" | ||
| unique_together = (("project", "stack_root"),) | ||
|
|
||
|
|
||
| class OrganizationIntegration(DefaultFieldsModel): | ||
| __core__ = False | ||
|
|
||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@MeredithAnya should we have
db_constraint=Falsehere as well?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's probably fine, I don't think repository is very high volume. Can't check at the moment :(