Adding theme migration (#524)

selenium-screenshot-testing
Kevin Chung 2017-12-13 16:40:34 -05:00 committed by GitHub
parent a571cf1baf
commit 90b4ee03ad
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 51 additions and 0 deletions

View File

@ -0,0 +1,51 @@
"""Change theme from original to core
Revision ID: d5a224bf5862
Revises: c12d2a1b0926
Create Date: 2017-12-13 16:06:51.644187
"""
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 = 'd5a224bf5862'
down_revision = 'c12d2a1b0926'
branch_labels = None
depends_on = None
config_table = table('config',
column('id', db.Integer),
column('key', db.Text),
column('value', db.Text)
)
def upgrade():
# ### commands auto generated by Alembic - please adjust! ###
connection = op.get_bind()
connection.execute(
config_table.update().where(
and_(config_table.c.key == 'ctf_theme', config_table.c.value == 'original')
).values(
value='core'
)
)
# ### end Alembic commands ###
def downgrade():
# ### commands auto generated by Alembic - please adjust! ###
connection = op.get_bind()
connection.execute(
config_table.update().where(
and_(config_table.c.key == 'ctf_theme', config_table.c.value == 'core')
).values(
value='original'
)
)
# ### end Alembic commands ###