aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorElrond <elrond+mediagoblin.org@samba-tng.org>2012-03-01 21:34:21 +0100
committerElrond <elrond+mediagoblin.org@samba-tng.org>2012-03-01 21:58:49 +0100
commit94df840b3bf100a3fdd33e2fef2d4201d4a4ac45 (patch)
treec24989a2948353d4c7b8565c5c79d100d69c684a
parent2bc8ff0d63188f2168553d39ebf8756ae83053e1 (diff)
downloadmediagoblin-94df840b3bf100a3fdd33e2fef2d4201d4a4ac45.tar.lz
mediagoblin-94df840b3bf100a3fdd33e2fef2d4201d4a4ac45.tar.xz
mediagoblin-94df840b3bf100a3fdd33e2fef2d4201d4a4ac45.zip
SQL: Improve video media_data table
1. Make the foreignkey the primary_key. 2. Add width/height, as those are currently in use for the media_data
-rw-r--r--mediagoblin/db/sql/convert.py1
-rw-r--r--mediagoblin/media_types/video/models.py11
2 files changed, 7 insertions, 5 deletions
diff --git a/mediagoblin/db/sql/convert.py b/mediagoblin/db/sql/convert.py
index 79717913..250c559b 100644
--- a/mediagoblin/db/sql/convert.py
+++ b/mediagoblin/db/sql/convert.py
@@ -20,6 +20,7 @@ from mediagoblin.db.mongo.util import ObjectId
from mediagoblin.db.sql.models import (Base, User, MediaEntry, MediaComment,
Tag, MediaTag, MediaFile, MediaAttachmentFile)
+from mediagoblin.media_types.video.models import VideoData
from mediagoblin.db.sql.open import setup_connection_and_db_from_config as \
sql_connect
from mediagoblin.db.mongo.open import setup_connection_and_db_from_config as \
diff --git a/mediagoblin/media_types/video/models.py b/mediagoblin/media_types/video/models.py
index 741c329b..709d7910 100644
--- a/mediagoblin/media_types/video/models.py
+++ b/mediagoblin/media_types/video/models.py
@@ -18,16 +18,17 @@
from mediagoblin.db.sql.models import Base
from sqlalchemy import (
- Column, Integer, Unicode, UnicodeText, DateTime, Boolean, ForeignKey,
- UniqueConstraint)
+ Column, Integer, SmallInteger, ForeignKey)
class VideoData(Base):
__tablename__ = "video_data"
- id = Column(Integer, primary_key=True)
- media_entry = Column(
- Integer, ForeignKey('media_entries.id'), nullable=False)
+ # The primary key *and* reference to the main media_entry
+ media_entry = Column(Integer, ForeignKey('media_entries.id'),
+ primary_key=True)
+ width = Column(SmallInteger)
+ height = Column(SmallInteger)
DATA_MODEL = VideoData