You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
mailu/core/admin/migrations/versions/9c28df23f77e_.py

31 lines
926 B
Python

""" Set the nocase collation on the user and alias tables
Revision ID: 9c28df23f77e
Revises: c162ac88012a
Create Date: 2017-10-29 13:28:29.155754
"""
# revision identifiers, used by Alembic.
revision = '9c28df23f77e'
down_revision = 'c162ac88012a'
from alembic import op
import sqlalchemy as sa
from flask import current_app as app
def upgrade():
if app.config['DB_FLAVOR'] == 'sqlite':
with op.batch_alter_table('user') as batch:
batch.alter_column('email', type_=sa.String(length=255, collation="NOCASE"))
with op.batch_alter_table('alias') as batch:
batch.alter_column('email', type_=sa.String(length=255, collation="NOCASE"))
def downgrade():
with op.batch_alter_table('user') as batch:
batch.alter_column('email', type_=sa.String(length=255))
with op.batch_alter_table('alias') as batch:
batch.alter_column('email', type_=sa.String(length=255))