changed User model pw_hash field to nullable and added migrations
This commit is contained in:
parent
199685831d
commit
53012d08c5
@ -287,3 +287,14 @@ def unique_collections_slug(db):
|
|||||||
constraint.create()
|
constraint.create()
|
||||||
|
|
||||||
db.commit()
|
db.commit()
|
||||||
|
|
||||||
|
|
||||||
|
@RegisterMigration(11, MIGRATIONS)
|
||||||
|
def pw_hash_nullable(db):
|
||||||
|
"""Make pw_hash column nullable"""
|
||||||
|
metadata = MetaData(bind=db.bind)
|
||||||
|
user_table = inspect_table(metadata, "core__users")
|
||||||
|
|
||||||
|
user_table.c.pw_hash.alter(nullable=True)
|
||||||
|
|
||||||
|
db.commit()
|
||||||
|
@ -61,7 +61,7 @@ class User(Base, UserMixin):
|
|||||||
# point.
|
# point.
|
||||||
email = Column(Unicode, nullable=False)
|
email = Column(Unicode, nullable=False)
|
||||||
created = Column(DateTime, nullable=False, default=datetime.datetime.now)
|
created = Column(DateTime, nullable=False, default=datetime.datetime.now)
|
||||||
pw_hash = Column(Unicode, nullable=False)
|
pw_hash = Column(Unicode)
|
||||||
email_verified = Column(Boolean, default=False)
|
email_verified = Column(Boolean, default=False)
|
||||||
status = Column(Unicode, default=u"needs_email_verification", nullable=False)
|
status = Column(Unicode, default=u"needs_email_verification", nullable=False)
|
||||||
# Intented to be nullable=False, but migrations would not work for it
|
# Intented to be nullable=False, but migrations would not work for it
|
||||||
|
Loading…
x
Reference in New Issue
Block a user