aboutsummaryrefslogtreecommitdiffstats
path: root/mediagoblin/db/migrations.py
diff options
context:
space:
mode:
authorJessica Tallon <jessica@megworld.co.uk>2015-02-25 13:41:53 +0100
committerJessica Tallon <jessica@megworld.co.uk>2015-05-26 16:48:58 +0200
commit641ae2f1e1eaadb66446ca67fe29672c90155ca7 (patch)
tree20a55c6b4db3dd576adda6701cdd7ab336225767 /mediagoblin/db/migrations.py
parentb791ae973c816f2262fb7c6efa9444c75637150d (diff)
downloadmediagoblin-641ae2f1e1eaadb66446ca67fe29672c90155ca7.tar.lz
mediagoblin-641ae2f1e1eaadb66446ca67fe29672c90155ca7.tar.xz
mediagoblin-641ae2f1e1eaadb66446ca67fe29672c90155ca7.zip
Add GenericForeignKey field and reference helper model
Diffstat (limited to 'mediagoblin/db/migrations.py')
-rw-r--r--mediagoblin/db/migrations.py15
1 files changed, 15 insertions, 0 deletions
diff --git a/mediagoblin/db/migrations.py b/mediagoblin/db/migrations.py
index 74c1194f..446f30df 100644
--- a/mediagoblin/db/migrations.py
+++ b/mediagoblin/db/migrations.py
@@ -1249,3 +1249,18 @@ def datetime_to_utc(db):
# Commit this to the database
db.commit()
+
+class GenericModelReference_V0(declarative_base()):
+ __tablename__ = "core__generic_model_reference"
+
+ id = Column(Integer, primary_key=True)
+ obj_pk = Column(Integer, nullable=False)
+ model_type = Column(Unicode, nullable=False)
+
+@RegisterMigration(27, MIGRATIONS)
+def create_generic_model_reference(db):
+ """ Creates the Generic Model Reference table """
+ GenericModelReference_V0.__table__.create(db.bind)
+ db.commit()
+
+