소스 검색

Add CustomDomain.nb_failed_checks column

Son NK 4 년 전
부모
커밋
828799010b
2개의 변경된 파일36개의 추가작업 그리고 0개의 파일을 삭제
  1. 7 0
      app/models.py
  2. 29 0
      migrations/versions/2020_102016_eef0c404b531_.py

+ 7 - 0
app/models.py

@@ -1494,6 +1494,13 @@ class CustomDomain(db.Model, ModelMixin):
         db.Boolean, nullable=False, default=False, server_default="0"
         db.Boolean, nullable=False, default=False, server_default="0"
     )
     )
 
 
+    # incremented when a check is failed on the domain
+    # alert when the number exceeds a threshold
+    # used in check_custom_domain()
+    nb_failed_checks = db.Column(
+        db.Integer, default=0, server_default="0", nullable=False
+    )
+
     user = db.relationship(User, foreign_keys=[user_id])
     user = db.relationship(User, foreign_keys=[user_id])
 
 
     @property
     @property

+ 29 - 0
migrations/versions/2020_102016_eef0c404b531_.py

@@ -0,0 +1,29 @@
+"""empty message
+
+Revision ID: eef0c404b531
+Revises: 54ca2dbf89c0
+Create Date: 2020-10-20 16:49:33.756896
+
+"""
+import sqlalchemy_utils
+from alembic import op
+import sqlalchemy as sa
+
+
+# revision identifiers, used by Alembic.
+revision = 'eef0c404b531'
+down_revision = '54ca2dbf89c0'
+branch_labels = None
+depends_on = None
+
+
+def upgrade():
+    # ### commands auto generated by Alembic - please adjust! ###
+    op.add_column('custom_domain', sa.Column('nb_failed_checks', sa.Integer(), server_default='0', nullable=False))
+    # ### end Alembic commands ###
+
+
+def downgrade():
+    # ### commands auto generated by Alembic - please adjust! ###
+    op.drop_column('custom_domain', 'nb_failed_checks')
+    # ### end Alembic commands ###