-
-
Couldn't load subscription status.
- Fork 4.5k
feat(dashboards): Implements syncing prebuilt dashboards to backend #101968
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
Merged
edwardgou-sentry
merged 9 commits into
master
from
egou/feat/prebuilt-dashboard-sync-backend
Oct 23, 2025
Merged
Changes from all commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
07fe888
syncs prebuilt dashboards to backend
edwardgou-sentry 9faa220
Merge branch 'master' of github.com:getsentry/sentry into egou/feat/p…
edwardgou-sentry c899a8e
fix
edwardgou-sentry bbe9c1c
Merge branch 'master' of github.com:getsentry/sentry into egou/feat/p…
edwardgou-sentry d86d248
fix
edwardgou-sentry a690dd9
fix openapi
edwardgou-sentry 3ee86e0
constraint on prebuilt_id and created_by_id and also fix lock key
edwardgou-sentry b10680a
fix migration file
edwardgou-sentry 3d95e42
Merge branch 'master' of github.com:getsentry/sentry into egou/feat/p…
edwardgou-sentry File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
61 changes: 61 additions & 0 deletions
61
src/sentry/migrations/0998_add_prebuilt_id_to_dashboards.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,61 @@ | ||
| # Generated by Django 5.2.1 on 2025-10-23 15:14 | ||
|
|
||
| from django.db import migrations, models | ||
|
|
||
| import sentry.db.models.fields.bounded | ||
| import sentry.db.models.fields.hybrid_cloud_foreign_key | ||
| from sentry.new_migrations.migrations import CheckedMigration | ||
|
|
||
|
|
||
| class Migration(CheckedMigration): | ||
| # This flag is used to mark that a migration shouldn't be automatically run in production. | ||
| # This should only be used for operations where it's safe to run the migration after your | ||
| # code has deployed. So this should not be used for most operations that alter the schema | ||
| # of a table. | ||
| # Here are some things that make sense to mark as post deployment: | ||
| # - Large data migrations. Typically we want these to be run manually so that they can be | ||
| # monitored and not block the deploy for a long period of time while they run. | ||
| # - Adding indexes to large tables. Since this can take a long time, we'd generally prefer to | ||
| # run this outside deployments so that we don't block them. Note that while adding an index | ||
| # is a schema change, it's completely safe to run the operation after the code has deployed. | ||
| # Once deployed, run these manually via: https://develop.sentry.dev/database-migrations/#migration-deployment | ||
|
|
||
| is_post_deployment = False | ||
|
|
||
| dependencies = [ | ||
| ("sentry", "0997_add_has_trace_metrics_bit_to_project_model"), | ||
| ] | ||
|
|
||
| operations = [ | ||
| migrations.AddField( | ||
| model_name="dashboard", | ||
| name="prebuilt_id", | ||
| field=sentry.db.models.fields.bounded.BoundedPositiveIntegerField( | ||
| db_default=None, null=True | ||
| ), | ||
| ), | ||
| migrations.AlterField( | ||
| model_name="dashboard", | ||
| name="created_by_id", | ||
| field=sentry.db.models.fields.hybrid_cloud_foreign_key.HybridCloudForeignKey( | ||
| "sentry.User", db_index=True, null=True, on_delete="CASCADE" | ||
| ), | ||
| ), | ||
| migrations.AddConstraint( | ||
| model_name="dashboard", | ||
| constraint=models.UniqueConstraint( | ||
| condition=models.Q(("prebuilt_id__isnull", False)), | ||
| fields=("organization", "prebuilt_id"), | ||
| name="sentry_dashboard_organization_prebuilt_id_uniq", | ||
| ), | ||
| ), | ||
| migrations.AddConstraint( | ||
| model_name="dashboard", | ||
| constraint=models.CheckConstraint( | ||
| condition=models.Q( | ||
| ("prebuilt_id__isnull", True), ("created_by_id__isnull", True), _connector="OR" | ||
| ), | ||
| name="sentry_dashboard_prebuilt_null_created_by", | ||
| ), | ||
| ), | ||
| ] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
If you're excluding none in the conditions, I don't think this filter condition will be hit.
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.
So I had to add this here because
mypywould still interpretidasint | Nonedespite the filter condition.I think this should be fine? Alternatively should we just add a type ignore? Let me know what you think!
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.
ah ok. Sacrifices must be made to the mypy gods 🔥