Merge "PGSQL: create Enum before using"

This commit is contained in:
Jenkins 2017-07-29 21:40:20 +00:00 committed by Gerrit Code Review
commit 75199063e9
2 changed files with 9 additions and 2 deletions

View File

@ -36,10 +36,12 @@ Node = sql.table('nodes',
def upgrade():
state_enum = sa.Enum(*istate.States.all(), name='node_state')
state_enum.create(op.get_bind())
op.add_column('nodes', sa.Column('version_id', sa.String(36),
server_default=''))
op.add_column('nodes', sa.Column('state', sa.Enum(*istate.States.all(),
name='node_state'),
op.add_column('nodes', sa.Column('state', state_enum,
nullable=False,
default=istate.States.finished,
server_default=istate.States.finished))

View File

@ -0,0 +1,5 @@
---
fixes:
- |
Create the node_state enum explicitly in the migration, as it is required
by PostgreSQL