mirror of https://github.com/JohnHammond/CTFd.git
Adding theme migration (#524)
parent
a571cf1baf
commit
90b4ee03ad
|
@ -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 ###
|
Loading…
Reference in New Issue