mirror of
https://github.com/minetest/contentdb.git
synced 2025-01-24 23:11:33 +01:00
Fix username being case-sensitive
This commit is contained in:
parent
6fd36dbfff
commit
b84727b187
@ -96,15 +96,15 @@ class User(db.Model, UserMixin):
|
|||||||
id = db.Column(db.Integer, primary_key=True)
|
id = db.Column(db.Integer, primary_key=True)
|
||||||
|
|
||||||
# User authentication information
|
# User authentication information
|
||||||
username = db.Column(db.String(50), nullable=False, unique=True)
|
username = db.Column(db.String(50, collation="NOCASE"), nullable=False, unique=True, index=True)
|
||||||
password = db.Column(db.String(255), nullable=True)
|
password = db.Column(db.String(255), nullable=True)
|
||||||
reset_password_token = db.Column(db.String(100), nullable=False, server_default="")
|
reset_password_token = db.Column(db.String(100), nullable=False, server_default="")
|
||||||
|
|
||||||
rank = db.Column(db.Enum(UserRank))
|
rank = db.Column(db.Enum(UserRank))
|
||||||
|
|
||||||
# Account linking
|
# Account linking
|
||||||
github_username = db.Column(db.String(50), nullable=True, unique=True)
|
github_username = db.Column(db.String(50, collation="NOCASE"), nullable=True, unique=True)
|
||||||
forums_username = db.Column(db.String(50), nullable=True, unique=True)
|
forums_username = db.Column(db.String(50, collation="NOCASE"), nullable=True, unique=True)
|
||||||
|
|
||||||
# User email information
|
# User email information
|
||||||
email = db.Column(db.String(255), nullable=True, unique=True)
|
email = db.Column(db.String(255), nullable=True, unique=True)
|
||||||
|
35
migrations/versions/28a427cbd4cf_.py
Normal file
35
migrations/versions/28a427cbd4cf_.py
Normal file
@ -0,0 +1,35 @@
|
|||||||
|
"""empty message
|
||||||
|
|
||||||
|
Revision ID: 28a427cbd4cf
|
||||||
|
Revises: e9f534df23a8
|
||||||
|
Create Date: 2018-06-03 01:47:33.006039
|
||||||
|
|
||||||
|
"""
|
||||||
|
from alembic import op
|
||||||
|
import sqlalchemy as sa
|
||||||
|
import sqlalchemy.types as ty
|
||||||
|
|
||||||
|
|
||||||
|
# revision identifiers, used by Alembic.
|
||||||
|
revision = '28a427cbd4cf'
|
||||||
|
down_revision = 'e9f534df23a8'
|
||||||
|
branch_labels = None
|
||||||
|
depends_on = None
|
||||||
|
|
||||||
|
|
||||||
|
def upgrade():
|
||||||
|
# ### commands auto generated by Alembic - please adjust! ###
|
||||||
|
op.alter_column('user','username', type_=ty.VARCHAR(50, collation='NOCASE'))
|
||||||
|
op.alter_column('user','github_username', type_=ty.VARCHAR(50, collation='NOCASE'))
|
||||||
|
op.alter_column('user','forums_username', type_=ty.VARCHAR(50, collation='NOCASE'))
|
||||||
|
op.create_index(op.f('ix_user_username'), 'user', ['username'], unique=True)
|
||||||
|
# ### end Alembic commands ###
|
||||||
|
|
||||||
|
|
||||||
|
def downgrade():
|
||||||
|
# ### commands auto generated by Alembic - please adjust! ###
|
||||||
|
op.alter_column('user','username', type_=ty.VARCHAR(50))
|
||||||
|
op.alter_column('user','github_username', type_=ty.VARCHAR(50))
|
||||||
|
op.alter_column('user','forums_username', type_=ty.VARCHAR(50))
|
||||||
|
op.drop_index(op.f('ix_user_username'), table_name='user')
|
||||||
|
# ### end Alembic commands ###
|
Loading…
Reference in New Issue
Block a user