From 8999b6e9a57df1018c956d47e53f6fb377855729 Mon Sep 17 00:00:00 2001 From: Cayo Puigdefabregas Date: Mon, 23 Nov 2020 18:42:31 +0100 Subject: [PATCH] adding migration for live --- .../versions/e93aec8fc41f_added_assigned_action.py | 12 ++++++++++++ ereuse_devicehub/resources/action/models.py | 4 ++-- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/ereuse_devicehub/migrations/versions/e93aec8fc41f_added_assigned_action.py b/ereuse_devicehub/migrations/versions/e93aec8fc41f_added_assigned_action.py index f1940919..59010a74 100644 --- a/ereuse_devicehub/migrations/versions/e93aec8fc41f_added_assigned_action.py +++ b/ereuse_devicehub/migrations/versions/e93aec8fc41f_added_assigned_action.py @@ -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()}') diff --git a/ereuse_devicehub/resources/action/models.py b/ereuse_devicehub/resources/action/models.py index 94fabd1e..416e612c 100644 --- a/ereuse_devicehub/resources/action/models.py +++ b/ereuse_devicehub/resources/action/models.py @@ -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):