changed User model pw_hash field to nullable and added migrations
authorRodney Ewing <ewing.rj@gmail.com>
Mon, 13 May 2013 22:49:50 +0000 (15:49 -0700)
committerRodney Ewing <ewing.rj@gmail.com>
Fri, 24 May 2013 23:52:48 +0000 (16:52 -0700)
mediagoblin/db/migrations.py
mediagoblin/db/models.py

index 2c55339608610c90726e56d1ffa26741a23e158d..1617db48e2995ac1fb473b7742ae939de44e4cb5 100644 (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)
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