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
This commit is contained in:
parent
2bc8ff0d63
commit
94df840b3b
@ -20,6 +20,7 @@ from mediagoblin.db.mongo.util import ObjectId
|
|||||||
|
|
||||||
from mediagoblin.db.sql.models import (Base, User, MediaEntry, MediaComment,
|
from mediagoblin.db.sql.models import (Base, User, MediaEntry, MediaComment,
|
||||||
Tag, MediaTag, MediaFile, MediaAttachmentFile)
|
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 \
|
from mediagoblin.db.sql.open import setup_connection_and_db_from_config as \
|
||||||
sql_connect
|
sql_connect
|
||||||
from mediagoblin.db.mongo.open import setup_connection_and_db_from_config as \
|
from mediagoblin.db.mongo.open import setup_connection_and_db_from_config as \
|
||||||
|
@ -18,16 +18,17 @@
|
|||||||
from mediagoblin.db.sql.models import Base
|
from mediagoblin.db.sql.models import Base
|
||||||
|
|
||||||
from sqlalchemy import (
|
from sqlalchemy import (
|
||||||
Column, Integer, Unicode, UnicodeText, DateTime, Boolean, ForeignKey,
|
Column, Integer, SmallInteger, ForeignKey)
|
||||||
UniqueConstraint)
|
|
||||||
|
|
||||||
|
|
||||||
class VideoData(Base):
|
class VideoData(Base):
|
||||||
__tablename__ = "video_data"
|
__tablename__ = "video_data"
|
||||||
|
|
||||||
id = Column(Integer, primary_key=True)
|
# The primary key *and* reference to the main media_entry
|
||||||
media_entry = Column(
|
media_entry = Column(Integer, ForeignKey('media_entries.id'),
|
||||||
Integer, ForeignKey('media_entries.id'), nullable=False)
|
primary_key=True)
|
||||||
|
width = Column(SmallInteger)
|
||||||
|
height = Column(SmallInteger)
|
||||||
|
|
||||||
|
|
||||||
DATA_MODEL = VideoData
|
DATA_MODEL = VideoData
|
||||||
|
Loading…
x
Reference in New Issue
Block a user