Created
May 11, 2014 17:12
-
-
Save SuryaSankar/95138a59d16054cca757 to your computer and use it in GitHub Desktop.
Alembic migration for modifying a Enum field
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from alembic import op | |
import sqlalchemy as sa | |
def upgrade(): | |
op.alter_column(table_name='items', column_name='status', nullable=False, server_default="pending_with_moderator", name="status", | |
type_=sa.types.Enum('pending_with_moderator','pending_with_user','awaiting_user_modification','awaiting_moderator_modification','approved'), | |
existing_type=sa.types.Enum('pending_with_moderator', 'pending_with_user', 'approved'),existing_server_default="pending_with_moderator", | |
existing_nullable=False) | |
def downgrade(): | |
op.alter_column(table_name='items', column_name='status', nullable=False, server_default="pending_with_moderator", name="status", | |
existing_type=sa.types.Enum('pending_with_moderator','pending_with_user','awaiting_user_modification','awaiting_moderator_modification','approved'), | |
type_=sa.types.Enum('pending_with_moderator', 'pending_with_user', 'approved'),existing_server_default="pending_with_moderator", | |
existing_nullable=False) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment