changed User model pw_hash field to nullable and added migrations

This commit is contained in:
Rodney Ewing 2013-05-13 15:49:50 -07:00
parent 0f3504e35b
commit b56b6b1e77
2 changed files with 10 additions and 1 deletions

View File

@ -287,3 +287,12 @@ def unique_collections_slug(db):
constraint.create()
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)

View File

@ -61,7 +61,7 @@ class User(Base, UserMixin):
# point.
email = Column(Unicode, nullable=False)
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)
status = Column(Unicode, default=u"needs_email_verification", nullable=False)
# Intented to be nullable=False, but migrations would not work for it