diff --git a/ereuse_devicehub/migrations/versions/51439cf24be8_change_trade_action.py b/ereuse_devicehub/migrations/versions/51439cf24be8_change_trade_action.py index ee88c875..9fdae40d 100644 --- a/ereuse_devicehub/migrations/versions/51439cf24be8_change_trade_action.py +++ b/ereuse_devicehub/migrations/versions/51439cf24be8_change_trade_action.py @@ -148,7 +148,6 @@ def upgrade(): name='currency', create_type=False, checkfirst=True, - schema=f'{get_inv()}', ) op.drop_table('trade', schema=f'{get_inv()}') diff --git a/ereuse_devicehub/migrations/versions/b4bd1538bad5_update_live.py b/ereuse_devicehub/migrations/versions/b4bd1538bad5_update_live.py index 6f30c10c..ffaa57ea 100644 --- a/ereuse_devicehub/migrations/versions/b4bd1538bad5_update_live.py +++ b/ereuse_devicehub/migrations/versions/b4bd1538bad5_update_live.py @@ -25,6 +25,20 @@ def get_inv(): def upgrade(): + # op.execute("COMMIT") + op.execute("ALTER TYPE snapshotsoftware ADD VALUE 'WorkbenchDesktop'") + SOFTWARE = sa.Enum( + 'Workbench', + 'WorkbenchAndroid', + 'AndroidApp', + 'Web', + 'DesktopApp', + 'WorkbenchDesktop', + name='snapshotsoftware', + create_type=False, + checkfirst=True, + ) + # Live action op.drop_table('live', schema=f'{get_inv()}') op.create_table( @@ -44,19 +58,7 @@ def upgrade(): sa.Column( 'licence_version', teal.db.StrictVersionType(length=32), nullable=False ), - sa.Column( - 'software', - sa.Enum( - 'Workbench', - 'WorkbenchAndroid', - 'AndroidApp', - 'Web', - 'DesktopApp', - 'WorkbenchDesktop', - name='snapshotsoftware', - ), - nullable=False, - ), + sa.Column('software', SOFTWARE, nullable=False), sa.ForeignKeyConstraint( ['id'], [f'{get_inv()}.action.id'], @@ -86,3 +88,6 @@ def downgrade(): sa.PrimaryKeyConstraint('id'), schema=f'{get_inv()}', ) + op.execute( + "select e.enumlabel FROM pg_enum e JOIN pg_type t ON e.enumtypid = t.oid WHERE t.typname = 'snapshotsoftware'" + )