From b56b6b1e77cc01aa1ebebd1c6c594ec79cb4d8c1 Mon Sep 17 00:00:00 2001 From: Rodney Ewing Date: Mon, 13 May 2013 15:49:50 -0700 Subject: [PATCH] changed User model pw_hash field to nullable and added migrations --- mediagoblin/db/migrations.py | 9 +++++++++ mediagoblin/db/models.py | 2 +- 2 files changed, 10 insertions(+), 1 deletion(-) 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 -- 2.25.1