fixing migrations
This commit is contained in:
parent
dbbab28844
commit
1c34ea0074
|
@ -5,10 +5,10 @@ Revises: 3eb50297c365
|
||||||
Create Date: 2020-12-29 20:19:46.981207
|
Create Date: 2020-12-29 20:19:46.981207
|
||||||
|
|
||||||
"""
|
"""
|
||||||
|
from alembic import context
|
||||||
from alembic import op
|
from alembic import op
|
||||||
import sqlalchemy as sa
|
import sqlalchemy as sa
|
||||||
import sqlalchemy_utils
|
from sqlalchemy.dialects import postgresql
|
||||||
import citext
|
|
||||||
import teal
|
import teal
|
||||||
|
|
||||||
|
|
||||||
|
@ -27,18 +27,31 @@ def get_inv():
|
||||||
|
|
||||||
def upgrade():
|
def upgrade():
|
||||||
# Live action
|
# Live action
|
||||||
op.add_column('device',
|
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('usage_time_hdd', sa.Interval(), nullable=True),
|
||||||
|
sa.Column('snapshot_uuid', postgresql.UUID(as_uuid=True), nullable=False),
|
||||||
sa.Column('software_version', teal.db.StrictVersionType(length=32), nullable=False),
|
sa.Column('software_version', teal.db.StrictVersionType(length=32), nullable=False),
|
||||||
sa.Column('licence_version', teal.db.StrictVersionType(length=32), nullable=False),
|
sa.Column('licence_version', teal.db.StrictVersionType(length=32), nullable=False),
|
||||||
sa.Column('software', sa.Enum('Workbench', 'WorkbenchAndroid', 'AndroidApp', 'Web',
|
sa.Column('software', sa.Enum('Workbench', 'WorkbenchAndroid', 'AndroidApp', 'Web',
|
||||||
'DesktopApp', 'WorkbenchDesktop', name='snapshotsoftware'), nullable=False),
|
'DesktopApp', 'WorkbenchDesktop', name='snapshotsoftware'), nullable=False),
|
||||||
nullable=True), schema=f'{get_inv()}')
|
sa.ForeignKeyConstraint(['id'], [f'{get_inv()}.action.id'], ),
|
||||||
|
sa.PrimaryKeyConstraint('id'),
|
||||||
|
schema=f'{get_inv()}'
|
||||||
|
)
|
||||||
|
|
||||||
def downgrade():
|
def downgrade():
|
||||||
op.drop_column('device',
|
op.drop_table('live', schema=f'{get_inv()}')
|
||||||
sa.Column('software_version', teal.db.StrictVersionType(length=32), nullable=False),
|
op.create_table('live',
|
||||||
sa.Column('licence_version', teal.db.StrictVersionType(length=32), nullable=False),
|
sa.Column('id', postgresql.UUID(as_uuid=True), nullable=False),
|
||||||
sa.Column('software', sa.Enum('Workbench', 'WorkbenchAndroid', 'AndroidApp', 'Web',
|
sa.Column('serial_number', sa.Unicode(), nullable=True,
|
||||||
'DesktopApp', 'WorkbenchDesktop', name='snapshotsoftware'), nullable=False),
|
comment='The serial number of the Hard Disk in lower case.'),
|
||||||
nullable=True), schema=f'{get_inv()}')
|
sa.Column('usage_time_hdd', sa.Interval(), nullable=True),
|
||||||
|
sa.Column('snapshot_uuid', postgresql.UUID(as_uuid=True), nullable=False),
|
||||||
|
sa.ForeignKeyConstraint(['id'], [f'{get_inv()}.action.id'], ),
|
||||||
|
sa.PrimaryKeyConstraint('id'),
|
||||||
|
schema=f'{get_inv()}'
|
||||||
|
)
|
||||||
|
|
Reference in New Issue