adding migration for live

This commit is contained in:
Cayo Puigdefabregas 2020-11-23 18:42:31 +01:00
parent 8b4c27dfe2
commit 8999b6e9a5
2 changed files with 14 additions and 2 deletions

View File

@ -53,5 +53,17 @@ def upgrade():
# Receive action
op.drop_table('receive', schema=f'{get_inv()}')
# Live action
op.drop_table('live', schema=f'{get_inv()}')
op.create_table('live',
sa.Column('id', postgresql.UUID(as_uuid=True), nullable=False),
sa.Column('serial_number', sa.Unicode(), nullable=True,
comment='The serial number of the Hard Disk in lower case.'),
sa.Column('time', sa.Interval(), nullable=True),
sa.ForeignKeyConstraint(['id'], [f'{get_inv()}.action.id'], ),
sa.PrimaryKeyConstraint('id'),
schema=f'{get_inv()}'
)
def downgrade():
op.drop_table('allocate', schema=f'{get_inv()}')

View File

@ -1296,8 +1296,8 @@ class Live(JoinedWithOneDeviceMixin, ActionWithOneDevice):
and usage statistics.
"""
serial_number = Column(Unicode(), check_lower('serial_number'))
serial_number.comment = """The serial number of the HardDisk in lower case."""
time = Column(Interval)
serial_number.comment = """The serial number of the Hard Disk in lower case."""
time = Column(Interval, nullable=True)
class Organize(JoinedTableMixin, ActionWithMultipleDevices):