Skip to content

Commit

Permalink
Adding theme migration (CTFd#524)
Browse files Browse the repository at this point in the history
  • Loading branch information
ColdHeat authored Dec 13, 2017
1 parent a571cf1 commit 90b4ee0
Showing 1 changed file with 51 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -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 ###

0 comments on commit 90b4ee0

Please sign in to comment.