Addressed ticket number 630 by removing MediaEntry.collected
authorJosie <josephine.bartholoma@mgail.com>
Tue, 19 Nov 2013 01:05:15 +0000 (20:05 -0500)
committerJosie <josephine.bartholoma@mgail.com>
Tue, 19 Nov 2013 01:05:15 +0000 (20:05 -0500)
mediagoblin/db/migrations.py
mediagoblin/db/models.py
mediagoblin/user_pages/lib.py
mediagoblin/user_pages/views.py

index 966817fc1ff1d19d3790cc33c81bad24b153a778..339bc9632b5054f743a141adfba6fac5330eabbd 100644 (file)
@@ -706,4 +706,18 @@ def create_moderation_tables(db):
         email_verified.drop()
         is_admin.drop()
 
+    db.commit()
+@RegisterMigration(19, MIGRATIONS)
+def drop_MediaEntry_collected(db):
+    """
+    Drop unused MediaEntry.collected column
+    """
+    metadata = MetaData(bind=db.bind)
+    media_collected= inspect_table(metadata, 'core__media_entries')
+
+    media_collected = media_collected.columns['collected']
+
+        
+    media_collected.drop()
+        
     db.commit()
index 1514a3aa680d8b46dfcabcb514622b8ba6789e26..079578a229cf0b2a0c1802c6fd09cc2ebe9560bb 100644 (file)
@@ -219,12 +219,11 @@ class MediaEntry(Base, MediaEntryMixin):
     state = Column(Unicode, default=u'unprocessed', nullable=False)
         # or use sqlalchemy.types.Enum?
     license = Column(Unicode)
-    collected = Column(Integer, default=0)
+
     file_size = Column(Integer, default=0)
 
     fail_error = Column(Unicode)
     fail_metadata = Column(JSONEncoded)
-
     transcoding_progress = Column(SmallInteger)
 
     queued_media_file = Column(PathTupleWithSlashes)
index 80eb30bdf90666434e4037a43a9bf496c0eec6d4..16da89d6e25c87b687ad988b3f8b33827c96eaae 100644 (file)
@@ -1,4 +1,4 @@
-# GNU MediaGoblin -- federated, autonomous media hosting
+# GNU MediaGobli:n -- federated, autonomous media hosting
 # Copyright (C) 2011, 2012 MediaGoblin contributors.  See AUTHORS.
 #
 # This program is free software: you can redistribute it and/or modify
@@ -72,7 +72,7 @@ def add_media_to_collection(collection, media, note=None, commit=True):
     collection.items = collection.items + 1
     Session.add(collection)
 
-    media.collected = media.collected + 1
+   
     Session.add(media)
 
     if commit:
index 73823e4d3992855021f84cd0e8397dd07d28d756..64fa793e0349d50c29ad9221da2c10c7b5b016aa 100644 (file)
@@ -389,7 +389,6 @@ def collection_item_confirm_remove(request, collection_item):
 
         if form.confirm.data is True:
             entry = collection_item.get_media_entry
-            entry.collected = entry.collected - 1
             entry.save()
 
             collection_item.delete()
@@ -436,7 +435,6 @@ def collection_confirm_delete(request, collection):
             # Delete all the associated collection items
             for item in collection.get_collection_items():
                 entry = item.get_media_entry
-                entry.collected = entry.collected - 1
                 entry.save()
                 item.delete()