From bb0d7bf6dc36e8d013befc7f13da3cb6c3830c46 Mon Sep 17 00:00:00 2001 From: kaiyou Date: Sat, 21 Apr 2018 13:25:48 +0200 Subject: [PATCH] Enforce the nocase collation on the email table --- .../migrations/versions/049fed905da7_.py | 25 +++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 core/admin/migrations/versions/049fed905da7_.py diff --git a/core/admin/migrations/versions/049fed905da7_.py b/core/admin/migrations/versions/049fed905da7_.py new file mode 100644 index 00000000..ce410844 --- /dev/null +++ b/core/admin/migrations/versions/049fed905da7_.py @@ -0,0 +1,25 @@ +""" Enforce the nocase collation on the email table + +Revision ID: 049fed905da7 +Revises: 49d77a93118e +Create Date: 2018-04-21 13:23:56.571524 + +""" + +# revision identifiers, used by Alembic. +revision = '049fed905da7' +down_revision = '49d77a93118e' + +from alembic import op +import sqlalchemy as sa + + +def upgrade(): + with op.batch_alter_table('user') 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)) +