Add notes field to client and probe tables

This commit is contained in:
Lance Edgar 2018-09-28 12:26:49 -05:00
parent 152ea26c02
commit 30a0f98e1d
2 changed files with 47 additions and 0 deletions

View file

@ -0,0 +1,39 @@
# -*- coding: utf-8; -*-
"""add client, probe notes
Revision ID: 34041e1032a2
Revises: e9eb7fc0a451
Create Date: 2018-09-28 12:24:11.348627
"""
from __future__ import unicode_literals, absolute_import
# revision identifiers, used by Alembic.
revision = '34041e1032a2'
down_revision = u'e9eb7fc0a451'
branch_labels = None
depends_on = None
from alembic import op
import sqlalchemy as sa
import rattail.db.types
def upgrade():
# client
op.add_column('client', sa.Column('notes', sa.Text(), nullable=True))
# probe
op.add_column('probe', sa.Column('notes', sa.Text(), nullable=True))
def downgrade():
# probe
op.drop_column('probe', 'notes')
# client
op.drop_column('client', 'notes')

View file

@ -60,6 +60,10 @@ class Client(Base):
not set, a default of 60 seconds will be assumed. not set, a default of 60 seconds will be assumed.
""") """)
notes = sa.Column(sa.Text(), nullable=True, doc="""
Any arbitrary notes for the client.
""")
enabled = sa.Column(sa.Boolean(), nullable=False, default=False) enabled = sa.Column(sa.Boolean(), nullable=False, default=False)
online = sa.Column(sa.Boolean(), nullable=False, default=False) online = sa.Column(sa.Boolean(), nullable=False, default=False)
@ -117,6 +121,10 @@ class Probe(Base):
therm_status_timeout = sa.Column(sa.Integer(), nullable=False) therm_status_timeout = sa.Column(sa.Integer(), nullable=False)
status_alert_timeout = sa.Column(sa.Integer(), nullable=False) status_alert_timeout = sa.Column(sa.Integer(), nullable=False)
notes = sa.Column(sa.Text(), nullable=True, doc="""
Any arbitrary notes for the probe.
""")
status = sa.Column(sa.Integer(), nullable=True) status = sa.Column(sa.Integer(), nullable=True)
status_changed = sa.Column(sa.DateTime(), nullable=True) status_changed = sa.Column(sa.DateTime(), nullable=True)
status_alert_sent = sa.Column(sa.DateTime(), nullable=True) status_alert_sent = sa.Column(sa.DateTime(), nullable=True)