Commits

inklesspen committed 496e314

Adding enum field to the blog post model

Comments (0)

Files changed (2)

     summary = Column(Unicode(), nullable=False)
     created_at = Column(DateTime(timezone=True), nullable=False)
     text = Column(UnicodeText(), nullable=False)
+    status = Column(Enum("inprogress", "posted", metadata=Base.metadata, name="post_status"), nullable=False, index=True)
 
 target_metadata = Base.metadata
 

alembic/versions/45632af0038d_add_enum_field_to_bl.py

+"""add enum field to blog post
+
+Revision ID: 45632af0038d
+Revises: 3fd052046533
+Create Date: 2013-01-14 20:50:15.544974
+
+"""
+
+# revision identifiers, used by Alembic.
+revision = '45632af0038d'
+down_revision = '3fd052046533'
+
+from alembic import op
+import sqlalchemy as sa
+
+
+def upgrade():
+    ### commands auto generated by Alembic - please adjust! ###
+    op.add_column('blogposts', sa.Column('status', sa.Enum('inprogress', 'posted', name='post_status'), nullable=False))
+    ### end Alembic commands ###
+
+
+def downgrade():
+    ### commands auto generated by Alembic - please adjust! ###
+    op.drop_column('blogposts', 'status')
+    ### end Alembic commands ###