From: Rodney Ewing Date: Mon, 13 May 2013 22:49:50 +0000 (-0700) Subject: changed User model pw_hash field to nullable and added migrations X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=b56b6b1e77cc01aa1ebebd1c6c594ec79cb4d8c1;p=mediagoblin.git changed User model pw_hash field to nullable and added migrations --- diff --git a/mediagoblin/db/migrations.py b/mediagoblin/db/migrations.py index 2c553396..1617db48 100644 --- a/mediagoblin/db/migrations.py +++ b/mediagoblin/db/migrations.py @@ -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) diff --git a/mediagoblin/db/models.py b/mediagoblin/db/models.py index 2b925983..323ed4d7 100644 --- a/mediagoblin/db/models.py +++ b/mediagoblin/db/models.py @@ -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