Add CustomDomain.nb_failed_checks column

This commit is contained in:
Son NK 2020-10-20 16:50:01 +02:00
parent 8482a55df6
commit 828799010b
2 changed files with 36 additions and 0 deletions

View File

@ -1494,6 +1494,13 @@ class CustomDomain(db.Model, ModelMixin):
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])
@property

View File

@ -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 ###