changed User model pw_hash field to nullable and added migrations
authorRodney Ewing <ewing.rj@gmail.com>
Thu, 23 May 2013 21:33:56 +0000 (14:33 -0700)
committerRodney Ewing <ewing.rj@gmail.com>
Sat, 25 May 2013 01:16:53 +0000 (18:16 -0700)
mediagoblin/db/migrations.py
mediagoblin/db/models.py

index 2c55339608610c90726e56d1ffa26741a23e158d..1f92417eb76c89ac82249129fd508e8601dbf30c 100644 (file)
@@ -287,3 +287,14 @@ 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)
+
+    db.commit()
index 2b92598344baaaee3edefbc6e877878077c97de0..323ed4d7cbb690ed89737b16a93b6932135a87fd 100644 (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