aboutsummaryrefslogtreecommitdiffstats
path: root/mediagoblin/db
diff options
context:
space:
mode:
Diffstat (limited to 'mediagoblin/db')
-rw-r--r--mediagoblin/db/migrations.py11
-rw-r--r--mediagoblin/db/models.py5
2 files changed, 14 insertions, 2 deletions
diff --git a/mediagoblin/db/migrations.py b/mediagoblin/db/migrations.py
index 1c0a9291..984ef060 100644
--- a/mediagoblin/db/migrations.py
+++ b/mediagoblin/db/migrations.py
@@ -542,7 +542,7 @@ def create_moderation_tables(db):
@RegisterMigration(16, MIGRATIONS)
def update_user_privilege_columns(db):
- metadata = MetaData(bind=db.bind)
+ # first, create the privileges which would be created by foundations
default_privileges = Privilege.query.filter(
Privilege.privilege_name !=u'admin').filter(
Privilege.privilege_name !=u'moderator').filter(
@@ -551,6 +551,7 @@ def update_user_privilege_columns(db):
Privilege.privilege_name ==u'admin').first()
active_privilege = Privilege.query.filter(
Privilege.privilege_name ==u'active').first()
+ # then, assign them to the appropriate users
for inactive_user in User.query.filter(
User.status!=u'active').filter(
User.is_admin==False).all():
@@ -569,3 +570,11 @@ def update_user_privilege_columns(db):
admin_user.all_privileges = default_privileges + [
admin_privilege, active_privilege]
admin_user.save()
+
+ # and then drop the now vestigial status column
+ metadata = MetaData(bind=db.bind)
+ user_table = inspect_table(metadata, 'core__users')
+ status = user_table.columns['status']
+ status.drop()
+ db.commit()
+
diff --git a/mediagoblin/db/models.py b/mediagoblin/db/models.py
index 5b77a85d..ce1de36b 100644
--- a/mediagoblin/db/models.py
+++ b/mediagoblin/db/models.py
@@ -63,13 +63,16 @@ class User(Base, UserMixin):
# point.
email = Column(Unicode, nullable=False)
pw_hash = Column(Unicode)
+#--column email_verified is VESTIGIAL with privileges and should not be used---
+#--should be dropped ASAP though a bug in sqlite3 prevents this atm------------
email_verified = Column(Boolean, default=False)
created = Column(DateTime, nullable=False, default=datetime.datetime.now)
- status = Column(Unicode, default=u"needs_email_verification", nullable=False)
# Intented to be nullable=False, but migrations would not work for it
# set to nullable=True implicitly.
wants_comment_notification = Column(Boolean, default=True)
license_preference = Column(Unicode)
+#--column admin is VESTIGIAL with privileges and should not be used------------
+#--should be dropped ASAP though a bug in sqlite3 prevents this atm------------
is_admin = Column(Boolean, default=False, nullable=False)
url = Column(Unicode)
bio = Column(UnicodeText) # ??