forked from kompetenzinventar/ki-backend
fix availability migration for MySQL
This commit is contained in:
parent
b63c0f3ede
commit
f0d05bbf22
@ -9,7 +9,6 @@ from alembic import op
|
|||||||
import sqlalchemy as sa
|
import sqlalchemy as sa
|
||||||
from sqlalchemy.sql import expression
|
from sqlalchemy.sql import expression
|
||||||
|
|
||||||
|
|
||||||
# revision identifiers, used by Alembic.
|
# revision identifiers, used by Alembic.
|
||||||
revision = '459520b01f34'
|
revision = '459520b01f34'
|
||||||
down_revision = '9183e2335b05'
|
down_revision = '9183e2335b05'
|
||||||
@ -20,8 +19,12 @@ depends_on = None
|
|||||||
def upgrade():
|
def upgrade():
|
||||||
# ### commands auto generated by Alembic - please adjust! ###
|
# ### commands auto generated by Alembic - please adjust! ###
|
||||||
with op.batch_alter_table("profile") as batch_op:
|
with op.batch_alter_table("profile") as batch_op:
|
||||||
batch_op.alter_column('availability', new_column_name='availability_text')
|
batch_op.alter_column('availability',
|
||||||
batch_op.add_column(sa.Column('availability_status', sa.Boolean(), server_default=expression.true(), nullable=False))
|
new_column_name='availability_text',
|
||||||
|
existing_type=sa.String(4000),
|
||||||
|
existing_server_default="")
|
||||||
|
batch_op.add_column(
|
||||||
|
sa.Column('availability_status', sa.Boolean(), server_default=expression.true(), nullable=False))
|
||||||
batch_op.add_column(sa.Column('availability_hours_per_week', sa.Integer(), nullable=True))
|
batch_op.add_column(sa.Column('availability_hours_per_week', sa.Integer(), nullable=True))
|
||||||
# ### end Alembic commands ###
|
# ### end Alembic commands ###
|
||||||
|
|
||||||
@ -29,7 +32,10 @@ def upgrade():
|
|||||||
def downgrade():
|
def downgrade():
|
||||||
# ### commands auto generated by Alembic - please adjust! ###
|
# ### commands auto generated by Alembic - please adjust! ###
|
||||||
with op.batch_alter_table("profile") as batch_op:
|
with op.batch_alter_table("profile") as batch_op:
|
||||||
batch_op.alter_column('availability_text', new_column_name='availability')
|
batch_op.alter_column('availability_text',
|
||||||
|
new_column_name='availability',
|
||||||
|
existing_type=sa.String(4000),
|
||||||
|
existing_serve_server_default="")
|
||||||
batch_op.drop_column('availability_hours_per_week')
|
batch_op.drop_column('availability_hours_per_week')
|
||||||
batch_op.drop_column('availability_status')
|
batch_op.drop_column('availability_status')
|
||||||
# ### end Alembic commands ###
|
# ### end Alembic commands ###
|
||||||
|
Loading…
Reference in New Issue
Block a user