Commit Alembic 'count' column migration script

This uses `server_default` for the column creation instead of default.
Perhaps it is the ALTER COLUMN or NULLABLE part of the migration causing
 the issue, I'm still not completely sure.
This commit is contained in:
Xevion
2021-02-18 04:33:25 -06:00
parent 5a4da4cec0
commit 866e8ae83a

View File

@@ -0,0 +1,30 @@
"""Added count column for # of votes
Revision ID: c8eed03794f7
Revises: b26551e73407
Create Date: 2021-02-18 02:49:47.900742-06:00
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = 'c8eed03794f7'
down_revision = 'b26551e73407'
branch_labels = None
depends_on = None
def upgrade():
# ### commands auto generated by Alembic - please adjust! ###
with op.batch_alter_table('submission', schema=None) as batch_op:
batch_op.add_column(sa.Column('count', sa.Integer(), server_default="0", nullable=False))
# ### end Alembic commands ###
def downgrade():
# ### commands auto generated by Alembic - please adjust! ###
with op.batch_alter_table('submission', schema=None) as batch_op:
batch_op.drop_column('count')
# ### end Alembic commands ###