Mv db.sql.base to db.base
[mediagoblin.git] / mediagoblin / media_types / ascii / models.py
CommitLineData
3ea1cf36
CAW
1# GNU MediaGoblin -- federated, autonomous media hosting
2# Copyright (C) 2011, 2012 MediaGoblin contributors. See AUTHORS.
3#
4# This program is free software: you can redistribute it and/or modify
5# it under the terms of the GNU Affero General Public License as published by
6# the Free Software Foundation, either version 3 of the License, or
7# (at your option) any later version.
8#
9# This program is distributed in the hope that it will be useful,
10# but WITHOUT ANY WARRANTY; without even the implied warranty of
11# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12# GNU Affero General Public License for more details.
13#
14# You should have received a copy of the GNU Affero General Public License
15# along with this program. If not, see <http://www.gnu.org/licenses/>.
16
17
39dc3bf8 18from mediagoblin.db.base import Base
3ea1cf36
CAW
19
20from sqlalchemy import (
02f07bfe
E
21 Column, Integer, ForeignKey)
22from sqlalchemy.orm import relationship, backref
3ea1cf36
CAW
23
24
0562898e
E
25BACKREF_NAME = "ascii__media_data"
26
27
3ea1cf36 28class AsciiData(Base):
2f5ce68c 29 __tablename__ = "ascii__mediadata"
3ea1cf36 30
8fd81053
E
31 # The primary key *and* reference to the main media_entry
32 media_entry = Column(Integer, ForeignKey('core__media_entries.id'),
33 primary_key=True)
02f07bfe 34 get_media_entry = relationship("MediaEntry",
0562898e 35 backref=backref(BACKREF_NAME, cascade="all, delete-orphan"))
3ea1cf36
CAW
36
37
38DATA_MODEL = AsciiData
39MODELS = [AsciiData]