-
-
Notifications
You must be signed in to change notification settings - Fork 4.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(metric_alerts): Allow trigger thresholds to be float (#19075)
This updates the data model to convert the threshold fields from int -> float. The data migration should be fine since this table is small/not on a hot path. I tested having code where the model still has `models.IntegerField` defined, but the database has `double`, and everything continued to work as usual - fetches and updates all worked fine and didn't cause type conversion errors.
- Loading branch information
Showing
5 changed files
with
68 additions
and
7 deletions.
There are no files selected for viewing
This file contains 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 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 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,42 @@ | ||
# -*- coding: utf-8 -*- | ||
# Generated by Django 1.11.29 on 2020-05-29 20:19 | ||
from __future__ import unicode_literals | ||
|
||
from django.db import migrations, models | ||
|
||
|
||
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', '0081_add_integraiton_upgrade_audit_log'), | ||
] | ||
|
||
operations = [ | ||
migrations.AlterField( | ||
model_name='alertruletrigger', | ||
name='alert_threshold', | ||
field=models.FloatField(), | ||
), | ||
migrations.AlterField( | ||
model_name='alertruletrigger', | ||
name='resolve_threshold', | ||
field=models.FloatField(null=True), | ||
), | ||
] |
This file contains 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 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