Fix #279. Update existing enum
This commit is contained in:
parent
e081310069
commit
c2bff5dd92
|
@ -148,7 +148,6 @@ def upgrade():
|
||||||
name='currency',
|
name='currency',
|
||||||
create_type=False,
|
create_type=False,
|
||||||
checkfirst=True,
|
checkfirst=True,
|
||||||
schema=f'{get_inv()}',
|
|
||||||
)
|
)
|
||||||
|
|
||||||
op.drop_table('trade', schema=f'{get_inv()}')
|
op.drop_table('trade', schema=f'{get_inv()}')
|
||||||
|
|
|
@ -25,6 +25,20 @@ def get_inv():
|
||||||
|
|
||||||
|
|
||||||
def upgrade():
|
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
|
# Live action
|
||||||
op.drop_table('live', schema=f'{get_inv()}')
|
op.drop_table('live', schema=f'{get_inv()}')
|
||||||
op.create_table(
|
op.create_table(
|
||||||
|
@ -44,19 +58,7 @@ def upgrade():
|
||||||
sa.Column(
|
sa.Column(
|
||||||
'licence_version', teal.db.StrictVersionType(length=32), nullable=False
|
'licence_version', teal.db.StrictVersionType(length=32), nullable=False
|
||||||
),
|
),
|
||||||
sa.Column(
|
sa.Column('software', SOFTWARE, nullable=False),
|
||||||
'software',
|
|
||||||
sa.Enum(
|
|
||||||
'Workbench',
|
|
||||||
'WorkbenchAndroid',
|
|
||||||
'AndroidApp',
|
|
||||||
'Web',
|
|
||||||
'DesktopApp',
|
|
||||||
'WorkbenchDesktop',
|
|
||||||
name='snapshotsoftware',
|
|
||||||
),
|
|
||||||
nullable=False,
|
|
||||||
),
|
|
||||||
sa.ForeignKeyConstraint(
|
sa.ForeignKeyConstraint(
|
||||||
['id'],
|
['id'],
|
||||||
[f'{get_inv()}.action.id'],
|
[f'{get_inv()}.action.id'],
|
||||||
|
@ -86,3 +88,6 @@ def downgrade():
|
||||||
sa.PrimaryKeyConstraint('id'),
|
sa.PrimaryKeyConstraint('id'),
|
||||||
schema=f'{get_inv()}',
|
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'"
|
||||||
|
)
|
||||||
|
|
Reference in New Issue