Add device_id to client db

This commit is contained in:
Tulir Asokan 2020-07-11 16:22:27 +03:00
parent 9578883bbb
commit 09108f6a73
6 changed files with 47 additions and 10 deletions

View file

@ -56,6 +56,7 @@ def run_migrations_offline():
target_metadata=target_metadata,
literal_binds=True,
dialect_opts={"paramstyle": "named"},
render_as_batch=True,
)
with context.begin_transaction():
@ -77,7 +78,8 @@ def run_migrations_online():
with connectable.connect() as connection:
context.configure(
connection=connection, target_metadata=target_metadata
connection=connection, target_metadata=target_metadata,
render_as_batch=True,
)
with context.begin_transaction():

View file

@ -0,0 +1,32 @@
"""Add device_id to clients
Revision ID: 4b93300852aa
Revises: fccd1f95544d
Create Date: 2020-07-11 15:49:38.831459
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = '4b93300852aa'
down_revision = 'fccd1f95544d'
branch_labels = None
depends_on = None
def upgrade():
# ### commands auto generated by Alembic - please adjust! ###
with op.batch_alter_table('client', schema=None) as batch_op:
batch_op.add_column(sa.Column('device_id', sa.String(length=255), nullable=True))
# ### end Alembic commands ###
def downgrade():
# ### commands auto generated by Alembic - please adjust! ###
with op.batch_alter_table('client', schema=None) as batch_op:
batch_op.drop_column('device_id')
# ### end Alembic commands ###