Just fixing the order of migrations and a bit of whitespace.
This commit sponsored by Glenn McGrath. Thank you!
This commit is contained in:
parent
56c4ad89eb
commit
63866d806a
@ -474,6 +474,43 @@ def wants_notifications(db):
|
||||
col.create(user_table)
|
||||
db.commit()
|
||||
|
||||
|
||||
|
||||
@RegisterMigration(16, MIGRATIONS)
|
||||
def upload_limits(db):
|
||||
"""Add user upload limit columns"""
|
||||
metadata = MetaData(bind=db.bind)
|
||||
|
||||
user_table = inspect_table(metadata, 'core__users')
|
||||
media_entry_table = inspect_table(metadata, 'core__media_entries')
|
||||
|
||||
col = Column('uploaded', Integer, default=0)
|
||||
col.create(user_table)
|
||||
|
||||
col = Column('upload_limit', Integer)
|
||||
col.create(user_table)
|
||||
|
||||
col = Column('file_size', Integer, default=0)
|
||||
col.create(media_entry_table)
|
||||
|
||||
db.commit()
|
||||
|
||||
|
||||
@RegisterMigration(17, MIGRATIONS)
|
||||
def add_file_metadata(db):
|
||||
"""Add file_metadata to MediaFile"""
|
||||
metadata = MetaData(bind=db.bind)
|
||||
media_file_table = inspect_table(metadata, "core__mediafiles")
|
||||
|
||||
col = Column('file_metadata', MutationDict.as_mutable(JSONEncoded))
|
||||
col.create(media_file_table)
|
||||
|
||||
db.commit()
|
||||
|
||||
###################
|
||||
# Moderation tables
|
||||
###################
|
||||
|
||||
class ReportBase_v0(declarative_base()):
|
||||
__tablename__ = 'core__reports'
|
||||
id = Column(Integer, primary_key=True)
|
||||
@ -487,6 +524,7 @@ class ReportBase_v0(declarative_base()):
|
||||
result = Column(UnicodeText)
|
||||
__mapper_args__ = {'polymorphic_on': discriminator}
|
||||
|
||||
|
||||
class CommentReport_v0(ReportBase_v0):
|
||||
__tablename__ = 'core__reports_on_comments'
|
||||
__mapper_args__ = {'polymorphic_identity': 'comment_report'}
|
||||
@ -496,7 +534,6 @@ class CommentReport_v0(ReportBase_v0):
|
||||
comment_id = Column(Integer, ForeignKey(MediaComment.id), nullable=True)
|
||||
|
||||
|
||||
|
||||
class MediaReport_v0(ReportBase_v0):
|
||||
__tablename__ = 'core__reports_on_media'
|
||||
__mapper_args__ = {'polymorphic_identity': 'media_report'}
|
||||
@ -504,6 +541,7 @@ class MediaReport_v0(ReportBase_v0):
|
||||
id = Column('id',Integer, ForeignKey('core__reports.id'), primary_key=True)
|
||||
media_entry_id = Column(Integer, ForeignKey(MediaEntry.id), nullable=True)
|
||||
|
||||
|
||||
class UserBan_v0(declarative_base()):
|
||||
__tablename__ = 'core__user_bans'
|
||||
user_id = Column(Integer, ForeignKey(User.id), nullable=False,
|
||||
@ -511,11 +549,13 @@ class UserBan_v0(declarative_base()):
|
||||
expiration_date = Column(Date)
|
||||
reason = Column(UnicodeText, nullable=False)
|
||||
|
||||
|
||||
class Privilege_v0(declarative_base()):
|
||||
__tablename__ = 'core__privileges'
|
||||
id = Column(Integer, nullable=False, primary_key=True, unique=True)
|
||||
privilege_name = Column(Unicode, nullable=False, unique=True)
|
||||
|
||||
|
||||
class PrivilegeUserAssociation_v0(declarative_base()):
|
||||
__tablename__ = 'core__privileges_users'
|
||||
privilege_id = Column(
|
||||
@ -529,6 +569,7 @@ class PrivilegeUserAssociation_v0(declarative_base()):
|
||||
ForeignKey(Privilege.id),
|
||||
primary_key=True)
|
||||
|
||||
|
||||
PRIVILEGE_FOUNDATIONS_v0 = [{'privilege_name':u'admin'},
|
||||
{'privilege_name':u'moderator'},
|
||||
{'privilege_name':u'uploader'},
|
||||
@ -550,6 +591,7 @@ class User_vR1(declarative_base()):
|
||||
url = Column(Unicode)
|
||||
bio = Column(UnicodeText) # ??
|
||||
|
||||
|
||||
@RegisterMigration(18, MIGRATIONS)
|
||||
def create_moderation_tables(db):
|
||||
|
||||
@ -670,35 +712,3 @@ def create_moderation_tables(db):
|
||||
is_admin.drop()
|
||||
|
||||
db.commit()
|
||||
|
||||
|
||||
@RegisterMigration(16, MIGRATIONS)
|
||||
def upload_limits(db):
|
||||
"""Add user upload limit columns"""
|
||||
metadata = MetaData(bind=db.bind)
|
||||
|
||||
user_table = inspect_table(metadata, 'core__users')
|
||||
media_entry_table = inspect_table(metadata, 'core__media_entries')
|
||||
|
||||
col = Column('uploaded', Integer, default=0)
|
||||
col.create(user_table)
|
||||
|
||||
col = Column('upload_limit', Integer)
|
||||
col.create(user_table)
|
||||
|
||||
col = Column('file_size', Integer, default=0)
|
||||
col.create(media_entry_table)
|
||||
|
||||
db.commit()
|
||||
|
||||
|
||||
@RegisterMigration(17, MIGRATIONS)
|
||||
def add_file_metadata(db):
|
||||
"""Add file_metadata to MediaFile"""
|
||||
metadata = MetaData(bind=db.bind)
|
||||
media_file_table = inspect_table(metadata, "core__mediafiles")
|
||||
|
||||
col = Column('file_metadata', MutationDict.as_mutable(JSONEncoded))
|
||||
col.create(media_file_table)
|
||||
|
||||
db.commit()
|
||||
|
Loading…
x
Reference in New Issue
Block a user