# -*- coding: utf-8 -*-
"""
Tencent is pleased to support the open source community by making BK-LOG 蓝鲸日志平台 available.
Copyright (C) 2021 THL A29 Limited, a Tencent company.  All rights reserved.
BK-LOG 蓝鲸日志平台 is licensed under the MIT License.
License for BK-LOG 蓝鲸日志平台:
--------------------------------------------------------------------
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
documentation files (the "Software"), to deal in the Software without restriction, including without limitation
the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software,
and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial
portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT
LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
"""
# Generated by Django 1.11.2 on 2019-07-10 08:19
from __future__ import unicode_literals

import apps.models
from django.db import migrations, models


class Migration(migrations.Migration):

    initial = True

    dependencies = []

    operations = [
        migrations.CreateModel(
            name="AccessScenarioConfig",
            fields=[
                ("created_at", models.DateTimeField(auto_now_add=True, verbose_name="创建时间")),
                ("created_by", models.CharField(default="", max_length=32, verbose_name="创建者")),
                ("updated_at", models.DateTimeField(auto_now=True, null=True, verbose_name="更新时间")),
                ("updated_by", models.CharField(blank=True, default="", max_length=32, verbose_name="修改者")),
                (
                    "scenario_id",
                    models.CharField(
                        choices=[("log", "日志平台"), ("bkdata", "数据平台"), ("es", "自定义ES")],
                        max_length=64,
                        primary_key=True,
                        serialize=False,
                        verbose_name="接入场景标识：log，bkdata, es",
                    ),
                ),
                ("scenario_name", models.CharField(max_length=64, verbose_name="接入场景别名：日志、数据平台、用户ES")),
                ("is_active", models.BooleanField(default=True, verbose_name="是否可用")),
                ("orders", models.IntegerField(default=0, verbose_name="顺序")),
                ("description", models.TextField(default=None, null=True, verbose_name="描述")),
            ],
            options={
                "verbose_name": "数据接入场景配置",
                "verbose_name_plural": "数据接入场景配置",
            },
        ),
        migrations.CreateModel(
            name="AccessSourceConfig",
            fields=[
                ("created_at", models.DateTimeField(auto_now_add=True, verbose_name="创建时间")),
                ("created_by", models.CharField(default="", max_length=32, verbose_name="创建者")),
                ("updated_at", models.DateTimeField(auto_now=True, null=True, verbose_name="更新时间")),
                ("updated_by", models.CharField(blank=True, default="", max_length=32, verbose_name="修改者")),
                ("is_deleted", models.BooleanField(default=False, verbose_name="是否删除")),
                ("deleted_at", models.DateTimeField(blank=True, null=True, verbose_name="删除时间")),
                ("deleted_by", models.CharField(blank=True, max_length=32, null=True, verbose_name="删除者")),
                ("source_id", models.AutoField(primary_key=True, serialize=False, verbose_name="数据源ID")),
                ("source_name", models.CharField(max_length=64, verbose_name="数据源名称")),
                (
                    "scenario_id",
                    models.CharField(
                        choices=[("log", "日志平台"), ("bkdata", "数据平台"), ("es", "自定义ES")],
                        max_length=64,
                        verbose_name="接入场景标识",
                    ),
                ),
                ("project_id", models.IntegerField(default=None, null=True, verbose_name="项目ID")),
                ("properties", apps.models.JsonField(default=None, null=True, verbose_name="属性")),
                ("orders", models.IntegerField(default=0, verbose_name="顺序")),
                ("is_editable", models.BooleanField(default=True, verbose_name="是否可以编辑")),
            ],
            options={
                "verbose_name": "数据源配置",
                "verbose_name_plural": "数据源配置",
                "ordering": ("-orders", "-source_id"),
            },
        ),
        migrations.CreateModel(
            name="LogIndexSet",
            fields=[
                ("created_at", models.DateTimeField(auto_now_add=True, verbose_name="创建时间")),
                ("created_by", models.CharField(default="", max_length=32, verbose_name="创建者")),
                ("updated_at", models.DateTimeField(auto_now=True, null=True, verbose_name="更新时间")),
                ("updated_by", models.CharField(blank=True, default="", max_length=32, verbose_name="修改者")),
                ("is_deleted", models.BooleanField(default=False, verbose_name="是否删除")),
                ("deleted_at", models.DateTimeField(blank=True, null=True, verbose_name="删除时间")),
                ("deleted_by", models.CharField(blank=True, max_length=32, null=True, verbose_name="删除者")),
                ("index_set_id", models.AutoField(primary_key=True, serialize=False, verbose_name="索引集ID")),
                ("index_set_name", models.CharField(max_length=64, verbose_name="索引集名称")),
                ("project_id", models.IntegerField(db_index=True, verbose_name="项目ID")),
                ("bkdata_project_id", models.IntegerField(default=None, null=True, verbose_name="绑定的数据平台项目ID")),
                (
                    "scenario_id",
                    models.CharField(
                        choices=[("log", "日志平台"), ("bkdata", "数据平台"), ("es", "自定义ES")],
                        max_length=64,
                        verbose_name="接入场景标识",
                    ),
                ),
                ("source_id", models.IntegerField(verbose_name="数据源ID")),
                ("orders", models.IntegerField(default=0, verbose_name="顺序")),
                ("view_roles", apps.models.MultiStrSplitByCommaField(max_length=255, verbose_name="查看权限")),
            ],
            options={
                "verbose_name": "索引集配置",
                "verbose_name_plural": "索引集配置",
                "ordering": ("-orders", "-index_set_id"),
            },
        ),
        migrations.CreateModel(
            name="LogIndexSetData",
            fields=[
                ("created_at", models.DateTimeField(auto_now_add=True, verbose_name="创建时间")),
                ("created_by", models.CharField(default="", max_length=32, verbose_name="创建者")),
                ("updated_at", models.DateTimeField(auto_now=True, null=True, verbose_name="更新时间")),
                ("updated_by", models.CharField(blank=True, default="", max_length=32, verbose_name="修改者")),
                ("is_deleted", models.BooleanField(default=False, verbose_name="是否删除")),
                ("deleted_at", models.DateTimeField(blank=True, null=True, verbose_name="删除时间")),
                ("deleted_by", models.CharField(blank=True, max_length=32, null=True, verbose_name="删除者")),
                ("index_id", models.AutoField(primary_key=True, serialize=False, verbose_name="索引ID")),
                ("index_set_id", models.IntegerField(db_index=True, verbose_name="索引集ID")),
                ("bk_biz_id", models.IntegerField(default=None, null=True, verbose_name="业务ID")),
                ("result_table_id", models.CharField(max_length=255, verbose_name="结果表")),
                ("result_table_name", models.CharField(default=None, max_length=255, null=True, verbose_name="结果表名称")),
                ("time_field", models.CharField(default=True, max_length=64, null=True, verbose_name="时间字段")),
                (
                    "apply_status",
                    models.CharField(
                        choices=[("pending", "审批中"), ("normal", "正常"), ("deny", "拒绝"), ("abnormal", "异常")],
                        default="pending",
                        max_length=64,
                        verbose_name="审核状态",
                    ),
                ),
            ],
            options={
                "verbose_name": "索引集数据",
                "verbose_name_plural": "索引集数据",
                "ordering": ("-index_id",),
            },
        ),
        migrations.CreateModel(
            name="MonitorAlarmInfo",
            fields=[
                ("id", models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name="ID")),
                ("created_at", models.DateTimeField(auto_now_add=True, verbose_name="创建时间")),
                ("created_by", models.CharField(default="", max_length=32, verbose_name="创建者")),
                ("updated_at", models.DateTimeField(auto_now=True, null=True, verbose_name="更新时间")),
                ("updated_by", models.CharField(blank=True, default="", max_length=32, verbose_name="修改者")),
                ("policy_id", models.IntegerField(db_index=True, verbose_name="策略ID")),
                ("policy_name", models.CharField(default=None, max_length=64, null=True, verbose_name="策略名称")),
                ("monitor_id", models.CharField(default=None, max_length=64, null=True, verbose_name="监控标识")),
                ("project_id", models.IntegerField(default=None, null=True, verbose_name="项目ID")),
                ("index_set_id", models.IntegerField(default=None, null=True, verbose_name="索引集ID")),
                ("index_set_name", models.CharField(default=None, max_length=64, null=True, verbose_name="索引集名称")),
                ("additions", models.TextField(verbose_name="检索语句")),
                ("level", models.IntegerField(verbose_name="告警等级")),
                ("notice_time", models.DateTimeField(default=None, verbose_name="告警时间")),
                ("content", models.TextField(default=None, null=True, verbose_name="告警内容")),
                ("false_case", models.IntegerField(default=0, verbose_name="是否误告")),
                ("feedback", models.TextField(default=None, null=True, verbose_name="反馈")),
            ],
            options={
                "verbose_name": "监控告警",
                "verbose_name_plural": "监控告警",
            },
        ),
        migrations.CreateModel(
            name="MonitorConfig",
            fields=[
                ("created_at", models.DateTimeField(auto_now_add=True, verbose_name="创建时间")),
                ("created_by", models.CharField(default="", max_length=32, verbose_name="创建者")),
                ("updated_at", models.DateTimeField(auto_now=True, null=True, verbose_name="更新时间")),
                ("updated_by", models.CharField(blank=True, default="", max_length=32, verbose_name="修改者")),
                ("monitor_id", models.CharField(max_length=64, primary_key=True, serialize=False, verbose_name="监控标识")),
                ("monitor_name", models.CharField(max_length=64, verbose_name="监控别名")),
                ("module_path", models.CharField(max_length=255, verbose_name="监控实现类路径")),
                ("orders", models.IntegerField(default=0, verbose_name="顺序")),
                ("is_active", models.BooleanField(default=True, verbose_name="是否可用")),
                ("description", models.TextField(default=None, null=True, verbose_name="描述")),
            ],
            options={
                "verbose_name": "监控类型配置",
                "verbose_name_plural": "监控类型配置",
            },
        ),
        migrations.CreateModel(
            name="MonitorNoticeConfig",
            fields=[
                ("notice_id", models.AutoField(primary_key=True, serialize=False, verbose_name="通知ID")),
                ("notice_phone", models.BooleanField(default=False, verbose_name="是否电话通知")),
                ("notice_mail", models.BooleanField(default=False, verbose_name="是否邮件通知")),
                ("notice_sms", models.BooleanField(default=False, verbose_name="是否短信通知")),
                ("notice_wechat", models.BooleanField(default=False, verbose_name="是否微信通知")),
                ("notice_eewechat", models.BooleanField(default=False, verbose_name="是否企业微信通知")),
                ("alarm_begin_time", models.CharField(max_length=16, verbose_name="告警开始时间")),
                ("alarm_end_time", models.CharField(max_length=16, verbose_name="告警结束时间")),
                ("notice_roles", apps.models.MultiStrSplitByCommaField(max_length=255, verbose_name="通知角色")),
                ("notice_users", models.TextField(default=None, null=True, verbose_name="额外通知用户列表")),
            ],
            options={
                "verbose_name": "通知配置",
                "verbose_name_plural": "通知配置",
            },
        ),
        migrations.CreateModel(
            name="MonitorPolicyInfo",
            fields=[
                ("created_at", models.DateTimeField(auto_now_add=True, verbose_name="创建时间")),
                ("created_by", models.CharField(default="", max_length=32, verbose_name="创建者")),
                ("updated_at", models.DateTimeField(auto_now=True, null=True, verbose_name="更新时间")),
                ("updated_by", models.CharField(blank=True, default="", max_length=32, verbose_name="修改者")),
                ("is_deleted", models.BooleanField(default=False, verbose_name="是否删除")),
                ("deleted_at", models.DateTimeField(blank=True, null=True, verbose_name="删除时间")),
                ("deleted_by", models.CharField(blank=True, max_length=32, null=True, verbose_name="删除者")),
                ("policy_id", models.AutoField(primary_key=True, serialize=False, verbose_name="策略ID")),
                ("policy_name", models.CharField(max_length=64, verbose_name="策略名称")),
                ("monitor_id", models.CharField(max_length=64, verbose_name="监控标识")),
                ("project_id", models.IntegerField(db_index=True, verbose_name="项目ID")),
                ("index_set_id", models.IntegerField(verbose_name="索引集ID")),
                ("additions", models.TextField(verbose_name="检索语句")),
                (
                    "level",
                    models.IntegerField(choices=[(1, "致命"), (2, "预警"), (3, "提醒")], default=3, verbose_name="告警等级"),
                ),
                ("notice_id", models.IntegerField(verbose_name="通知ID")),
                ("is_active", models.BooleanField(default=True, verbose_name="是否可用")),
                ("is_sync", models.BooleanField(default=False, verbose_name="是否同步到监控源")),
                ("sync_time", models.DateTimeField(default=None, null=True, verbose_name="同步时间")),
                ("third_policy_id", models.CharField(default=None, max_length=64, null=True, verbose_name="第三方策略ID")),
            ],
            options={
                "verbose_name": "监控策略配置",
                "verbose_name_plural": "监控策略配置",
            },
        ),
        migrations.CreateModel(
            name="MonitorPolicyThreshold",
            fields=[
                ("id", models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name="ID")),
                ("policy_id", models.IntegerField(db_index=True, verbose_name="策略ID")),
                ("config_method", models.CharField(default="gte", max_length=32, verbose_name="方法")),
                ("config_threshold", models.IntegerField(verbose_name="次数")),
                ("config_range", models.IntegerField(verbose_name="周期")),
                ("converge_check_window", models.IntegerField(verbose_name="检测周期")),
                ("converge_count", models.IntegerField(verbose_name="触发次数")),
                ("converge_alarm_window", models.IntegerField(verbose_name="收敛时长")),
            ],
            options={
                "verbose_name": "蓝鲸阈值监控",
                "verbose_name_plural": "蓝鲸阈值监控",
            },
        ),
        migrations.CreateModel(
            name="MonitorShield",
            fields=[
                ("created_at", models.DateTimeField(auto_now_add=True, verbose_name="创建时间")),
                ("created_by", models.CharField(default="", max_length=32, verbose_name="创建者")),
                ("updated_at", models.DateTimeField(auto_now=True, null=True, verbose_name="更新时间")),
                ("updated_by", models.CharField(blank=True, default="", max_length=32, verbose_name="修改者")),
                ("is_deleted", models.BooleanField(default=False, verbose_name="是否删除")),
                ("deleted_at", models.DateTimeField(blank=True, null=True, verbose_name="删除时间")),
                ("deleted_by", models.CharField(blank=True, max_length=32, null=True, verbose_name="删除者")),
                ("shield_id", models.AutoField(primary_key=True, serialize=False, verbose_name="屏蔽策略")),
                ("project_id", models.IntegerField(db_index=True, verbose_name="项目ID")),
                (
                    "shield_type",
                    models.IntegerField(choices=[(1, "单次"), (2, "每天"), (3, "每周"), (4, "每月")], verbose_name="屏蔽类型"),
                ),
                ("begin_time", models.DateTimeField(verbose_name="起止日期-开始时间")),
                ("end_time", models.DateTimeField(verbose_name="起止日期-结束时间")),
                ("cycle_config", apps.models.JsonField(default=None, null=True, verbose_name="周期配置")),
                ("reason", models.TextField(default=None, null=True, verbose_name="屏蔽原因")),
            ],
            options={
                "verbose_name": "屏蔽策略",
                "verbose_name_plural": "屏蔽策略",
            },
        ),
        migrations.CreateModel(
            name="MonitorShieldPolicy",
            fields=[
                ("id", models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name="ID")),
                ("created_at", models.DateTimeField(auto_now_add=True, verbose_name="创建时间")),
                ("created_by", models.CharField(default="", max_length=32, verbose_name="创建者")),
                ("updated_at", models.DateTimeField(auto_now=True, null=True, verbose_name="更新时间")),
                ("updated_by", models.CharField(blank=True, default="", max_length=32, verbose_name="修改者")),
                ("shield_id", models.IntegerField(db_index=True, verbose_name="屏蔽策略ID")),
                ("policy_id", models.IntegerField(db_index=True, verbose_name="策略ID")),
                ("monitor_id", models.CharField(max_length=64, verbose_name="监控标识")),
                ("is_sync", models.BooleanField(default=False, verbose_name="是否同步到监控源")),
                ("sync_time", models.DateTimeField(default=None, null=True, verbose_name="同步时间")),
            ],
            options={
                "verbose_name": "屏蔽范围",
                "verbose_name_plural": "屏蔽范围",
            },
        ),
        migrations.CreateModel(
            name="ProjectInfo",
            fields=[
                ("created_at", models.DateTimeField(auto_now_add=True, verbose_name="创建时间")),
                ("created_by", models.CharField(default="", max_length=32, verbose_name="创建者")),
                ("updated_at", models.DateTimeField(auto_now=True, null=True, verbose_name="更新时间")),
                ("updated_by", models.CharField(blank=True, default="", max_length=32, verbose_name="修改者")),
                ("is_deleted", models.BooleanField(default=False, verbose_name="是否删除")),
                ("deleted_at", models.DateTimeField(blank=True, null=True, verbose_name="删除时间")),
                ("deleted_by", models.CharField(blank=True, max_length=32, null=True, verbose_name="删除者")),
                ("project_id", models.AutoField(primary_key=True, serialize=False, verbose_name="项目ID")),
                ("project_name", models.CharField(max_length=64, verbose_name="项目名称")),
                ("bk_biz_id", models.IntegerField(default=None, null=True, verbose_name="业务ID")),
                ("bk_app_code", models.CharField(max_length=64, verbose_name="接入的来源APP")),
                ("time_zone", models.CharField(max_length=64, verbose_name="时区")),
                ("description", models.TextField(null=True, verbose_name="描述")),
            ],
            options={
                "verbose_name": "项目列表",
                "verbose_name_plural": "项目列表",
            },
        ),
        migrations.CreateModel(
            name="ResourceChange",
            fields=[
                ("id", models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name="ID")),
                ("created_at", models.DateTimeField(auto_now_add=True, verbose_name="创建时间")),
                ("created_by", models.CharField(default="", max_length=32, verbose_name="创建者")),
                ("updated_at", models.DateTimeField(auto_now=True, null=True, verbose_name="更新时间")),
                ("updated_by", models.CharField(blank=True, default="", max_length=32, verbose_name="修改者")),
                ("project_id", models.IntegerField(db_index=True, verbose_name="项目ID")),
                (
                    "change_type",
                    models.CharField(
                        choices=[("user_group", "用户组"), ("resource", "资源")], max_length=64, verbose_name="变更类型"
                    ),
                ),
                ("group_id", models.IntegerField(default=None, null=True, verbose_name="用户组ID")),
                (
                    "resource_id",
                    models.CharField(
                        choices=[("index_set", "索引集"), ("monitor_policy", "监控策略")], max_length=64, verbose_name="资源类型"
                    ),
                ),
                ("resource_scope_id", models.CharField(max_length=64, verbose_name="范围")),
                ("sync_status", models.CharField(db_index=True, max_length=32, verbose_name="同步状态")),
                ("sync_time", models.DateTimeField(default=None, null=True, verbose_name="同步时间")),
            ],
            options={
                "verbose_name": "用户组变更记录",
                "verbose_name_plural": "用户组变更记录",
            },
        ),
        migrations.CreateModel(
            name="UserIndexSetConfig",
            fields=[
                ("id", models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name="ID")),
                ("created_at", models.DateTimeField(auto_now_add=True, verbose_name="创建时间")),
                ("created_by", models.CharField(default="", max_length=32, verbose_name="创建者")),
                ("updated_at", models.DateTimeField(auto_now=True, null=True, verbose_name="更新时间")),
                ("updated_by", models.CharField(blank=True, default="", max_length=32, verbose_name="修改者")),
                ("is_deleted", models.BooleanField(default=False, verbose_name="是否删除")),
                ("deleted_at", models.DateTimeField(blank=True, null=True, verbose_name="删除时间")),
                ("deleted_by", models.CharField(blank=True, max_length=32, null=True, verbose_name="删除者")),
                ("index_set_id", models.IntegerField(db_index=True, verbose_name="索引集ID")),
                ("display_fields", apps.models.JsonField(verbose_name="字段配置")),
            ],
            options={
                "verbose_name": "用户索引集配置",
                "verbose_name_plural": "用户索引集配置",
            },
        ),
    ]
