CTFd/migrations/versions/dab615389702_update_regex_f...

52 lines
1.2 KiB
Python

"""Update regex flags to be case_insensitive
Revision ID: dab615389702
Revises: d5a224bf5862
Create Date: 2018-05-03 18:18:53.343075
"""
from CTFd.models import db
from alembic import op
import sqlalchemy as sa
from sqlalchemy.dialects import mysql
from sqlalchemy.sql import text, table, column, and_
# revision identifiers, used by Alembic.
revision = 'dab615389702'
down_revision = 'd5a224bf5862'
branch_labels = None
depends_on = None
keys_table = table('keys',
column('id', db.Integer),
column('type', db.Text),
column('data', db.Text)
)
def upgrade():
# ### commands auto generated by Alembic - please adjust! ###
connection = op.get_bind()
connection.execute(
keys_table.update().where(
keys_table.c.type == 'regex'
).values(
data='case_insensitive'
)
)
# ### end Alembic commands ###
def downgrade():
# ### commands auto generated by Alembic - please adjust! ###
connection = op.get_bind()
connection.execute(
keys_table.update().where(
keys_table.c.type == 'regex'
).values(
data=None
)
)
# ### end Alembic commands ###