From dd0799ad0a0eb4c8792906c5fb1975bea446fc66 Mon Sep 17 00:00:00 2001 From: Elrond Date: Sat, 10 Mar 2012 21:01:45 +0100 Subject: [PATCH] Better media_data sql table for images. 1. Change to the current primary key = media_entry id layout 2. Add gps_{latitude,longitude} to the table. --- mediagoblin/media_types/image/models.py | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/mediagoblin/media_types/image/models.py b/mediagoblin/media_types/image/models.py index 296eca0a..7ffd209b 100644 --- a/mediagoblin/media_types/image/models.py +++ b/mediagoblin/media_types/image/models.py @@ -1,18 +1,19 @@ from mediagoblin.db.sql.models import Base from sqlalchemy import ( - Column, Integer, Unicode, UnicodeText, DateTime, Boolean, ForeignKey, - UniqueConstraint) + Column, Integer, Float, ForeignKey) class ImageData(Base): __tablename__ = "image_data" - id = Column(Integer, primary_key=True) + # The primary key *and* reference to the main media_entry + media_entry = Column(Integer, ForeignKey('media_entries.id'), + primary_key=True) width = Column(Integer) height = Column(Integer) - media_entry = Column( - Integer, ForeignKey('media_entries.id'), nullable=False) + gps_longitude = Column(Float) + gps_latitude = Column(Float) DATA_MODEL = ImageData -- 2.25.1