2022-06-03 08:09:47 -06:00
# Generated by Django 3.2.5 on 2022-05-31 14:46
import apps . alerts . escalation_snapshot . escalation_snapshot_mixin
import apps . alerts . integration_options_mixin
import apps . alerts . models . alert
import apps . alerts . models . alert_group
import apps . alerts . models . alert_receive_channel
import apps . alerts . models . channel_filter
import apps . alerts . models . custom_button
import apps . alerts . models . escalation_chain
import apps . alerts . models . escalation_policy
import apps . alerts . models . resolution_note
import datetime
import django . core . validators
from django . db import migrations , models
import django . db . models . deletion
import django . db . models . manager
2023-02-06 16:01:37 +08:00
import django_migration_linter as linter
2022-06-03 08:09:47 -06:00
2022-06-13 16:29:39 +03:00
from apps . alerts . integration_options_mixin import IntegrationOptionsMixin
2022-06-03 08:09:47 -06:00
class Migration ( migrations . Migration ) :
initial = True
dependencies = [
]
operations = [
2023-02-06 16:01:37 +08:00
linter . IgnoreMigration ( ) ,
2022-06-03 08:09:47 -06:00
migrations . CreateModel (
name = ' Alert ' ,
fields = [
( ' id ' , models . BigAutoField ( auto_created = True , primary_key = True , serialize = False , verbose_name = ' ID ' ) ) ,
( ' public_primary_key ' , models . CharField ( default = apps . alerts . models . alert . generate_public_primary_key_for_alert , max_length = 20 , unique = True , validators = [ django . core . validators . MinLengthValidator ( 13 ) ] ) ) ,
( ' is_resolve_signal ' , models . BooleanField ( default = False ) ) ,
( ' is_the_first_alert_in_group ' , models . BooleanField ( default = False ) ) ,
( ' message ' , models . TextField ( default = None , max_length = 3000 , null = True ) ) ,
( ' image_url ' , models . URLField ( default = None , max_length = 300 , null = True ) ) ,
( ' delivered ' , models . BooleanField ( default = False ) ) ,
( ' title ' , models . TextField ( default = None , max_length = 1500 , null = True ) ) ,
( ' created_at ' , models . DateTimeField ( auto_now_add = True ) ) ,
( ' link_to_upstream_details ' , models . URLField ( default = None , max_length = 500 , null = True ) ) ,
( ' integration_unique_data ' , models . JSONField ( default = None , null = True ) ) ,
( ' raw_request_data ' , models . JSONField ( ) ) ,
( ' integration_optimization_hash ' , models . CharField ( db_index = True , default = None , max_length = 100 , null = True ) ) ,
] ,
) ,
migrations . CreateModel (
name = ' AlertGroup ' ,
fields = [
( ' id ' , models . BigAutoField ( auto_created = True , primary_key = True , serialize = False , verbose_name = ' ID ' ) ) ,
( ' public_primary_key ' , models . CharField ( default = apps . alerts . models . alert_group . generate_public_primary_key_for_alert_group , max_length = 20 , unique = True , validators = [ django . core . validators . MinLengthValidator ( 13 ) ] ) ) ,
( ' distinction ' , models . CharField ( db_index = True , default = None , max_length = 100 , null = True ) ) ,
( ' verbose_name ' , models . TextField ( default = None , null = True ) ) ,
( ' inside_organization_number ' , models . IntegerField ( default = 0 ) ) ,
( ' resolved ' , models . BooleanField ( default = False ) ) ,
( ' resolved_by ' , models . IntegerField ( choices = [ ( 0 , ' source ' ) , ( 1 , ' user ' ) , ( 2 , ' not yet ' ) , ( 3 , ' last escalation step ' ) , ( 4 , ' archived ' ) , ( 5 , ' wiped ' ) , ( 6 , ' stop maintenance ' ) ] , default = 2 ) ) ,
( ' resolved_at ' , models . DateTimeField ( blank = True , null = True ) ) ,
( ' acknowledged ' , models . BooleanField ( default = False ) ) ,
( ' acknowledged_on_source ' , models . BooleanField ( default = False ) ) ,
( ' acknowledged_at ' , models . DateTimeField ( blank = True , null = True ) ) ,
( ' acknowledged_by ' , models . IntegerField ( choices = [ ( 0 , ' source ' ) , ( 1 , ' user ' ) , ( 2 , ' not yet ' ) , ( 3 , ' last escalation step ' ) , ( 4 , ' archived ' ) , ( 5 , ' wiped ' ) , ( 6 , ' stop maintenance ' ) ] , default = 2 ) ) ,
( ' acknowledged_by_confirmed ' , models . DateTimeField ( default = None , null = True ) ) ,
( ' is_escalation_finished ' , models . BooleanField ( default = False ) ) ,
( ' started_at ' , models . DateTimeField ( auto_now_add = True ) ) ,
( ' slack_message_sent ' , models . BooleanField ( default = False ) ) ,
( ' active_escalation_id ' , models . CharField ( default = None , max_length = 100 , null = True ) ) ,
( ' active_resolve_calculation_id ' , models . CharField ( default = None , max_length = 100 , null = True ) ) ,
( ' active_cache_for_web_calculation_id ' , models . CharField ( default = None , max_length = 100 , null = True ) ) ,
( ' silenced ' , models . BooleanField ( default = False ) ) ,
( ' silenced_at ' , models . DateTimeField ( null = True ) ) ,
( ' silenced_until ' , models . DateTimeField ( blank = True , null = True ) ) ,
( ' unsilence_task_uuid ' , models . CharField ( default = None , max_length = 100 , null = True ) ) ,
( ' reason_to_skip_escalation ' , models . IntegerField ( choices = [ ( 0 , ' account_inactive ' ) , ( 1 , ' channel_archived ' ) , ( 2 , ' no_reason ' ) , ( 3 , ' rate_limited ' ) , ( 4 , ' channel_not_specified ' ) , ( 5 , ' restricted_action ' ) ] , default = 2 ) ) ,
( ' manual_severity ' , models . IntegerField ( choices = [ ( 0 , ' high ' ) , ( 1 , ' low ' ) , ( 2 , ' none ' ) ] , default = 2 ) ) ,
( ' resolution_note_ts ' , models . CharField ( default = None , max_length = 100 , null = True ) ) ,
( ' cached_render_for_web ' , models . JSONField ( default = dict ) ) ,
( ' last_unique_unacknowledge_process_id ' , models . CharField ( default = None , max_length = 100 , null = True ) ) ,
( ' is_archived ' , models . BooleanField ( default = False ) ) ,
( ' wiped_at ' , models . DateTimeField ( default = None , null = True ) ) ,
( ' prevent_posting_alerts ' , models . BooleanField ( default = False ) ) ,
( ' maintenance_uuid ' , models . CharField ( default = None , max_length = 100 , null = True , unique = True ) ) ,
( ' raw_escalation_snapshot ' , models . JSONField ( default = None , null = True ) ) ,
( ' estimate_escalation_finish_time ' , models . DateTimeField ( default = None , null = True ) ) ,
( ' is_open_for_grouping ' , models . BooleanField ( blank = True , default = None , null = True ) ) ,
] ,
options = {
' get_latest_by ' : ' pk ' ,
} ,
bases = ( apps . alerts . models . alert_group . AlertGroupSlackRenderingMixin , apps . alerts . escalation_snapshot . escalation_snapshot_mixin . EscalationSnapshotMixin , models . Model ) ,
managers = [
( ' all_objects ' , django . db . models . manager . Manager ( ) ) ,
] ,
) ,
migrations . CreateModel (
name = ' AlertGroupCounter ' ,
fields = [
( ' id ' , models . BigAutoField ( auto_created = True , primary_key = True , serialize = False , verbose_name = ' ID ' ) ) ,
( ' value ' , models . PositiveBigIntegerField ( default = 0 ) ) ,
] ,
) ,
migrations . CreateModel (
name = ' AlertGroupLogRecord ' ,
fields = [
( ' id ' , models . BigAutoField ( auto_created = True , primary_key = True , serialize = False , verbose_name = ' ID ' ) ) ,
( ' type ' , models . IntegerField ( choices = [ ( 0 , ' Acknowledged ' ) , ( 1 , ' Unacknowledged ' ) , ( 2 , ' Invite ' ) , ( 3 , ' Stop invitation ' ) , ( 4 , ' Re-invite ' ) , ( 5 , ' Escalation triggered ' ) , ( 6 , ' Invitation triggered ' ) , ( 16 , ' Escalation finished ' ) , ( 7 , ' Silenced ' ) , ( 15 , ' Unsilenced ' ) , ( 8 , ' Attached ' ) , ( 9 , ' Unattached ' ) , ( 10 , ' Custom button triggered ' ) , ( 11 , ' Unacknowledged by timeout ' ) , ( 12 , ' Failed attachment ' ) , ( 13 , ' Incident resolved ' ) , ( 14 , ' Incident unresolved ' ) , ( 17 , ' Escalation failed ' ) , ( 18 , ' Acknowledge reminder triggered ' ) , ( 19 , ' Wiped ' ) , ( 20 , ' Deleted ' ) , ( 21 , ' Incident registered ' ) , ( 22 , ' A route is assigned to the incident ' ) ] ) ) ,
( ' created_at ' , models . DateTimeField ( auto_now_add = True ) ) ,
( ' reason ' , models . TextField ( default = None , null = True ) ) ,
( ' silence_delay ' , models . DurationField ( default = None , null = True ) ) ,
( ' eta ' , models . DateTimeField ( default = None , null = True ) ) ,
( ' escalation_error_code ' , models . PositiveIntegerField ( default = None , null = True ) ) ,
( ' escalation_policy_step ' , models . IntegerField ( default = None , null = True ) ) ,
( ' step_specific_info ' , models . JSONField ( default = None , null = True ) ) ,
] ,
) ,
migrations . CreateModel (
name = ' AlertGroupPostmortem ' ,
fields = [
( ' id ' , models . BigAutoField ( auto_created = True , primary_key = True , serialize = False , verbose_name = ' ID ' ) ) ,
2024-11-19 14:23:48 -05:00
( ' public_primary_key ' , models . CharField ( max_length = 20 , unique = True , validators = [ django . core . validators . MinLengthValidator ( 13 ) ] ) ) ,
2022-06-03 08:09:47 -06:00
( ' created_at ' , models . DateTimeField ( auto_now_add = True ) ) ,
( ' last_modified ' , models . DateTimeField ( auto_now = True ) ) ,
( ' text ' , models . TextField ( default = None , max_length = 3000 , null = True ) ) ,
] ,
) ,
migrations . CreateModel (
name = ' AlertReceiveChannel ' ,
fields = [
( ' id ' , models . BigAutoField ( auto_created = True , primary_key = True , serialize = False , verbose_name = ' ID ' ) ) ,
( ' maintenance_duration ' , models . DurationField ( choices = [ ( datetime . timedelta ( seconds = 3600 ) , ' 1 hour ' ) , ( datetime . timedelta ( seconds = 10800 ) , ' 3 hours ' ) , ( datetime . timedelta ( seconds = 21600 ) , ' 6 hours ' ) , ( datetime . timedelta ( seconds = 43200 ) , ' 12 hours ' ) , ( datetime . timedelta ( days = 1 ) , ' 24 hours ' ) ] , default = None , null = True ) ) ,
( ' maintenance_mode ' , models . IntegerField ( choices = [ ( 0 , ' Debug ' ) , ( 1 , ' Maintenance ' ) ] , default = None , null = True ) ) ,
( ' maintenance_uuid ' , models . CharField ( default = None , max_length = 250 , null = True , unique = True ) ) ,
( ' maintenance_started_at ' , models . DateTimeField ( default = None , null = True ) ) ,
( ' public_primary_key ' , models . CharField ( default = apps . alerts . models . alert_receive_channel . generate_public_primary_key_for_alert_receive_channel , max_length = 20 , unique = True , validators = [ django . core . validators . MinLengthValidator ( 13 ) ] ) ) ,
( ' created_at ' , models . DateTimeField ( auto_now_add = True ) ) ,
( ' deleted_at ' , models . DateTimeField ( blank = True , null = True ) ) ,
2022-06-13 16:29:39 +03:00
( ' integration ' , models . CharField ( choices = IntegrationOptionsMixin . INTEGRATION_CHOICES , default = IntegrationOptionsMixin . DEFAULT_INTEGRATION , max_length = 100 ) ) ,
2022-06-03 08:09:47 -06:00
( ' allow_source_based_resolving ' , models . BooleanField ( default = True ) ) ,
( ' token ' , models . CharField ( db_index = True , default = apps . alerts . models . alert_receive_channel . random_token_generator , max_length = 30 ) ) ,
( ' smile_code ' , models . TextField ( default = ' :slightly_smiling_face: ' ) ) ,
( ' verbal_name ' , models . CharField ( default = None , max_length = 150 , null = True ) ) ,
( ' integration_slack_channel_id ' , models . CharField ( default = None , max_length = 150 , null = True ) ) ,
( ' is_finished_alerting_setup ' , models . BooleanField ( default = False ) ) ,
( ' slack_title_template ' , models . TextField ( default = None , null = True ) ) ,
( ' slack_message_template ' , models . TextField ( default = None , null = True ) ) ,
( ' slack_image_url_template ' , models . TextField ( default = None , null = True ) ) ,
( ' sms_title_template ' , models . TextField ( default = None , null = True ) ) ,
( ' phone_call_title_template ' , models . TextField ( default = None , null = True ) ) ,
( ' web_title_template ' , models . TextField ( default = None , null = True ) ) ,
( ' web_message_template ' , models . TextField ( default = None , null = True ) ) ,
( ' web_image_url_template ' , models . TextField ( default = None , null = True ) ) ,
( ' email_title_template ' , models . TextField ( default = None , null = True ) ) ,
( ' email_message_template ' , models . TextField ( default = None , null = True ) ) ,
( ' telegram_title_template ' , models . TextField ( default = None , null = True ) ) ,
( ' telegram_message_template ' , models . TextField ( default = None , null = True ) ) ,
( ' telegram_image_url_template ' , models . TextField ( default = None , null = True ) ) ,
( ' source_link_template ' , models . TextField ( default = None , null = True ) ) ,
( ' grouping_id_template ' , models . TextField ( default = None , null = True ) ) ,
( ' resolve_condition_template ' , models . TextField ( default = None , null = True ) ) ,
( ' acknowledge_condition_template ' , models . TextField ( default = None , null = True ) ) ,
( ' messaging_backends_templates ' , models . JSONField ( default = None , null = True ) ) ,
( ' rate_limited_in_slack_at ' , models . DateTimeField ( default = None , null = True ) ) ,
( ' rate_limit_message_task_id ' , models . CharField ( default = None , max_length = 100 , null = True ) ) ,
] ,
bases = ( apps . alerts . integration_options_mixin . IntegrationOptionsMixin , models . Model ) ,
) ,
migrations . CreateModel (
name = ' ChannelFilter ' ,
fields = [
( ' id ' , models . BigAutoField ( auto_created = True , primary_key = True , serialize = False , verbose_name = ' ID ' ) ) ,
( ' order ' , models . PositiveIntegerField ( db_index = True , editable = False , verbose_name = ' order ' ) ) ,
( ' public_primary_key ' , models . CharField ( default = apps . alerts . models . channel_filter . generate_public_primary_key_for_channel_filter , max_length = 20 , unique = True , validators = [ django . core . validators . MinLengthValidator ( 13 ) ] ) ) ,
( ' notify_in_slack ' , models . BooleanField ( default = True , null = True ) ) ,
( ' notify_in_telegram ' , models . BooleanField ( default = False , null = True ) ) ,
( ' slack_channel_id ' , models . CharField ( default = None , max_length = 100 , null = True ) ) ,
( ' notification_backends ' , models . JSONField ( default = None , null = True ) ) ,
( ' created_at ' , models . DateTimeField ( auto_now_add = True ) ) ,
( ' filtering_term ' , models . CharField ( default = None , max_length = 1024 , null = True ) ) ,
( ' is_default ' , models . BooleanField ( default = False ) ) ,
] ,
options = {
' ordering ' : ( ' alert_receive_channel ' , ' is_default ' , ' order ' ) ,
} ,
) ,
migrations . CreateModel (
name = ' CustomButton ' ,
fields = [
( ' id ' , models . BigAutoField ( auto_created = True , primary_key = True , serialize = False , verbose_name = ' ID ' ) ) ,
( ' public_primary_key ' , models . CharField ( default = apps . alerts . models . custom_button . generate_public_primary_key_for_custom_button , max_length = 20 , unique = True , validators = [ django . core . validators . MinLengthValidator ( 13 ) ] ) ) ,
( ' created_at ' , models . DateTimeField ( auto_now_add = True ) ) ,
( ' name ' , models . CharField ( max_length = 100 ) ) ,
( ' webhook ' , models . CharField ( default = None , max_length = 1000 , null = True ) ) ,
( ' data ' , models . TextField ( default = None , null = True ) ) ,
( ' user ' , models . CharField ( default = None , max_length = 100 , null = True ) ) ,
( ' password ' , models . CharField ( default = None , max_length = 100 , null = True ) ) ,
( ' deleted_at ' , models . DateTimeField ( blank = True , null = True ) ) ,
( ' authorization_header ' , models . CharField ( default = None , max_length = 1000 , null = True ) ) ,
( ' forward_whole_payload ' , models . BooleanField ( default = False ) ) ,
] ,
) ,
migrations . CreateModel (
name = ' EscalationChain ' ,
fields = [
( ' id ' , models . BigAutoField ( auto_created = True , primary_key = True , serialize = False , verbose_name = ' ID ' ) ) ,
( ' public_primary_key ' , models . CharField ( default = apps . alerts . models . escalation_chain . generate_public_primary_key_for_escalation_chain , max_length = 20 , unique = True , validators = [ django . core . validators . MinLengthValidator ( 13 ) ] ) ) ,
( ' name ' , models . CharField ( max_length = 100 ) ) ,
] ,
) ,
migrations . CreateModel (
name = ' EscalationPolicy ' ,
fields = [
( ' id ' , models . BigAutoField ( auto_created = True , primary_key = True , serialize = False , verbose_name = ' ID ' ) ) ,
( ' order ' , models . PositiveIntegerField ( db_index = True , editable = False , verbose_name = ' order ' ) ) ,
( ' public_primary_key ' , models . CharField ( default = apps . alerts . models . escalation_policy . generate_public_primary_key_for_escalation_policy , max_length = 20 , unique = True , validators = [ django . core . validators . MinLengthValidator ( 13 ) ] ) ) ,
( ' step ' , models . IntegerField ( choices = [ ( 0 , ' Wait ' ) , ( 1 , ' Notify User ' ) , ( 2 , ' Notify Whole Channel ' ) , ( 3 , ' Repeat Escalation (5 times max) ' ) , ( 4 , ' Resolve ' ) , ( 5 , ' Notify Group ' ) , ( 6 , ' Notify Schedule ' ) , ( 7 , ' Notify User (Important) ' ) , ( 8 , ' Notify Group (Important) ' ) , ( 9 , ' Notify Schedule (Important) ' ) , ( 10 , ' Trigger Outgoing Webhook ' ) , ( 11 , ' Notify User (next each time) ' ) , ( 12 , ' Continue escalation only if time is from ' ) , ( 13 , ' Notify multiple Users ' ) , ( 14 , ' Notify multiple Users (Important) ' ) , ( 15 , ' Continue escalation if >X alerts per Y minutes ' ) ] , default = None , null = True ) ) ,
( ' wait_delay ' , models . DurationField ( choices = [ ( datetime . timedelta ( seconds = 60 ) , ' 1 min ' ) , ( datetime . timedelta ( seconds = 300 ) , ' 5 min ' ) , ( datetime . timedelta ( seconds = 900 ) , ' 15 min ' ) , ( datetime . timedelta ( seconds = 1800 ) , ' 30 min ' ) , ( datetime . timedelta ( seconds = 3600 ) , ' 60 min ' ) ] , default = None , null = True ) ) ,
( ' from_time ' , models . TimeField ( default = None , null = True ) ) ,
( ' to_time ' , models . TimeField ( default = None , null = True ) ) ,
( ' num_alerts_in_window ' , models . PositiveIntegerField ( default = None , null = True ) ) ,
( ' num_minutes_in_window ' , models . PositiveIntegerField ( default = None , null = True ) ) ,
] ,
options = {
' ordering ' : ( ' order ' , ) ,
' abstract ' : False ,
} ,
) ,
migrations . CreateModel (
name = ' GrafanaAlertingContactPoint ' ,
fields = [
( ' id ' , models . BigAutoField ( auto_created = True , primary_key = True , serialize = False , verbose_name = ' ID ' ) ) ,
( ' uid ' , models . CharField ( default = None , max_length = 100 , null = True ) ) ,
( ' name ' , models . CharField ( max_length = 100 ) ) ,
( ' datasource_name ' , models . CharField ( default = ' grafana ' , max_length = 100 ) ) ,
( ' datasource_id ' , models . IntegerField ( default = None , null = True ) ) ,
] ,
) ,
migrations . CreateModel (
name = ' Invitation ' ,
fields = [
( ' id ' , models . BigAutoField ( auto_created = True , primary_key = True , serialize = False , verbose_name = ' ID ' ) ) ,
( ' created_at ' , models . DateTimeField ( auto_now_add = True ) ) ,
( ' is_active ' , models . BooleanField ( default = True ) ) ,
( ' attempt ' , models . IntegerField ( default = 0 ) ) ,
] ,
) ,
migrations . CreateModel (
name = ' ResolutionNote ' ,
fields = [
( ' id ' , models . BigAutoField ( auto_created = True , primary_key = True , serialize = False , verbose_name = ' ID ' ) ) ,
( ' public_primary_key ' , models . CharField ( default = apps . alerts . models . resolution_note . generate_public_primary_key_for_resolution_note , max_length = 20 , unique = True , validators = [ django . core . validators . MinLengthValidator ( 13 ) ] ) ) ,
( ' source ' , models . IntegerField ( choices = [ ( 0 , ' slack ' ) , ( 1 , ' web ' ) ] , default = None , null = True ) ) ,
( ' message_text ' , models . TextField ( default = None , max_length = 3000 , null = True ) ) ,
( ' created_at ' , models . DateTimeField ( auto_now_add = True ) ) ,
( ' deleted_at ' , models . DateTimeField ( default = None , null = True ) ) ,
] ,
) ,
migrations . CreateModel (
name = ' ResolutionNoteSlackMessage ' ,
fields = [
( ' id ' , models . BigAutoField ( auto_created = True , primary_key = True , serialize = False , verbose_name = ' ID ' ) ) ,
( ' text ' , models . TextField ( default = None , max_length = 3000 , null = True ) ) ,
( ' slack_channel_id ' , models . CharField ( default = None , max_length = 100 , null = True ) ) ,
( ' ts ' , models . CharField ( default = None , max_length = 100 , null = True ) ) ,
( ' thread_ts ' , models . CharField ( default = None , max_length = 100 , null = True ) ) ,
( ' permalink ' , models . CharField ( default = None , max_length = 250 , null = True ) ) ,
( ' added_to_resolution_note ' , models . BooleanField ( default = False ) ) ,
( ' posted_by_bot ' , models . BooleanField ( default = False ) ) ,
] ,
) ,
migrations . CreateModel (
name = ' UserHasNotification ' ,
fields = [
( ' id ' , models . BigAutoField ( auto_created = True , primary_key = True , serialize = False , verbose_name = ' ID ' ) ) ,
( ' active_notification_policy_id ' , models . CharField ( default = None , max_length = 100 , null = True ) ) ,
( ' alert_group ' , models . ForeignKey ( on_delete = django . db . models . deletion . CASCADE , to = ' alerts.alertgroup ' ) ) ,
] ,
) ,
]