Skip to content

Commit

Permalink
涉及到实例的全部都增加一个instance 外键,后续用来调用, first commit of replacement
Browse files Browse the repository at this point in the history
  • Loading branch information
LeoQuote committed Mar 17, 2019
1 parent 4b04ffe commit e5120b4
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions sql/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,7 @@ class SqlWorkflow(models.Model):
status = models.CharField(max_length=50, choices=SQL_WORKFLOW_CHOICES)
is_backup = models.CharField('是否备份', choices=(('否', '否'), ('是', '是')), max_length=20)
review_content = models.TextField('自动审核内容的JSON格式')
instance = models.ForeignKey(Instance, on_delete=models.CASCADE)
instance_name = models.CharField('实例名称', max_length=50)
db_name = models.CharField('数据库', max_length=60)
reviewok_time = models.DateTimeField('人工审核通过的时间', null=True, blank=True)
Expand Down Expand Up @@ -269,6 +270,7 @@ class QueryPrivileges(models.Model):
privilege_id = models.AutoField(primary_key=True)
user_name = models.CharField('用户名', max_length=30)
user_display = models.CharField('申请人中文名', max_length=50, default='')
instance = models.ForeignKey(Instance, on_delete=models.CASCADE)
instance_name = models.CharField('实例名称', max_length=50)
db_name = models.CharField('数据库', max_length=200)
table_name = models.CharField('表', max_length=200)
Expand All @@ -291,6 +293,7 @@ class Meta:

# 记录在线查询sql的日志
class QueryLog(models.Model):
instance = models.ForeignKey(Instance, on_delete=models.CASCADE)
instance_name = models.CharField('实例名称', max_length=50)
db_name = models.CharField('数据库名称', max_length=30)
sqllog = models.TextField('执行的sql查询')
Expand All @@ -317,6 +320,7 @@ class DataMaskingColumns(models.Model):
rule_type = models.IntegerField('规则类型',
choices=((1, '手机号'), (2, '证件号码'), (3, '银行卡'), (4, '邮箱'), (5, '金额'), (6, '其他')))
active = models.IntegerField('激活状态', choices=((0, '未激活'), (1, '激活')))
instance = models.ForeignKey(Instance, on_delete=models.CASCADE)
instance_name = models.CharField('实例名称', max_length=50)
table_schema = models.CharField('字段所在库名', max_length=64)
table_name = models.CharField('字段所在表名', max_length=64)
Expand Down

0 comments on commit e5120b4

Please sign in to comment.