Add Client.disk_type to track SD card vs. USB

i.e. assuming raspberry pi device for the client.  kind of a specific use case
behind this but it seemed like it could be useful generally
This commit is contained in:
Lance Edgar 2018-09-28 19:14:25 -05:00
parent 30a0f98e1d
commit 18b224a3e0
2 changed files with 39 additions and 0 deletions

View file

@ -0,0 +1,33 @@
# -*- coding: utf-8; -*-
"""add client.disk_type
Revision ID: 5f2b87474433
Revises: 34041e1032a2
Create Date: 2018-09-28 19:08:02.743343
"""
from __future__ import unicode_literals, absolute_import
# revision identifiers, used by Alembic.
revision = '5f2b87474433'
down_revision = u'34041e1032a2'
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('disk_type', sa.Integer(), nullable=True))
def downgrade():
# client
op.drop_column('client', 'disk_type')

View file

@ -55,6 +55,12 @@ class Client(Base):
hostname = sa.Column(sa.String(length=255), nullable=False)
location = sa.Column(sa.String(length=255), nullable=True)
disk_type = sa.Column(sa.Integer(), nullable=True, doc="""
Integer code representing the type of hard disk used, if known. The
original motivation for this was to keep track of whether each client
(aka. Raspberry Pi) was using a SD card or USB drive for the root disk.
""")
delay = sa.Column(sa.Integer(), nullable=True, doc="""
Number of seconds to delay between reading / recording temperatures. If
not set, a default of 60 seconds will be assumed.