aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--mediagoblin/db/migrations.py13
-rw-r--r--mediagoblin/db/models.py1
-rw-r--r--mediagoblin/user_pages/lib.py2
-rw-r--r--mediagoblin/user_pages/views.py2
4 files changed, 13 insertions, 5 deletions
diff --git a/mediagoblin/db/migrations.py b/mediagoblin/db/migrations.py
index 966817fc..426080a2 100644
--- a/mediagoblin/db/migrations.py
+++ b/mediagoblin/db/migrations.py
@@ -707,3 +707,16 @@ def create_moderation_tables(db):
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()
diff --git a/mediagoblin/db/models.py b/mediagoblin/db/models.py
index 1514a3aa..b750375d 100644
--- a/mediagoblin/db/models.py
+++ b/mediagoblin/db/models.py
@@ -219,7 +219,6 @@ 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)
diff --git a/mediagoblin/user_pages/lib.py b/mediagoblin/user_pages/lib.py
index 80eb30bd..e5c8defc 100644
--- a/mediagoblin/user_pages/lib.py
+++ b/mediagoblin/user_pages/lib.py
@@ -71,8 +71,6 @@ 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:
diff --git a/mediagoblin/user_pages/views.py b/mediagoblin/user_pages/views.py
index 73823e4d..64fa793e 100644
--- a/mediagoblin/user_pages/views.py
+++ b/mediagoblin/user_pages/views.py
@@ -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()