mirror of
https://github.com/danswer-ai/danswer.git
synced 2025-09-29 13:25:50 +02:00
Lowercase all user emails (#3830)
This commit is contained in:
@@ -0,0 +1,37 @@
|
|||||||
|
"""lowercase_user_emails
|
||||||
|
|
||||||
|
Revision ID: 4d58345da04a
|
||||||
|
Revises: f1ca58b2f2ec
|
||||||
|
Create Date: 2025-01-29 07:48:46.784041
|
||||||
|
|
||||||
|
"""
|
||||||
|
from alembic import op
|
||||||
|
from sqlalchemy.sql import text
|
||||||
|
|
||||||
|
|
||||||
|
# revision identifiers, used by Alembic.
|
||||||
|
revision = "4d58345da04a"
|
||||||
|
down_revision = "f1ca58b2f2ec"
|
||||||
|
branch_labels = None
|
||||||
|
depends_on = None
|
||||||
|
|
||||||
|
|
||||||
|
def upgrade() -> None:
|
||||||
|
# Get database connection
|
||||||
|
connection = op.get_bind()
|
||||||
|
|
||||||
|
# Update all user emails to lowercase
|
||||||
|
connection.execute(
|
||||||
|
text(
|
||||||
|
"""
|
||||||
|
UPDATE "user"
|
||||||
|
SET email = LOWER(email)
|
||||||
|
WHERE email != LOWER(email)
|
||||||
|
"""
|
||||||
|
)
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
def downgrade() -> None:
|
||||||
|
# Cannot restore original case of emails
|
||||||
|
pass
|
Reference in New Issue
Block a user