aboutsummaryrefslogtreecommitdiffstats
path: root/mediagoblin/db/sql/models.py
diff options
context:
space:
mode:
authorChristopher Allan Webber <cwebber@dustycloud.org>2011-12-29 11:15:55 -0600
committerChristopher Allan Webber <cwebber@dustycloud.org>2012-01-29 16:33:44 -0600
commit70b44584ae4a81e53d39481781c63aec23b23884 (patch)
tree3057c7354c6c76c28845ab60588670fc536aa574 /mediagoblin/db/sql/models.py
parent8a9aa0758393336fb751c6f77a3d4feaa1903c06 (diff)
downloadmediagoblin-70b44584ae4a81e53d39481781c63aec23b23884.tar.lz
mediagoblin-70b44584ae4a81e53d39481781c63aec23b23884.tar.xz
mediagoblin-70b44584ae4a81e53d39481781c63aec23b23884.zip
Big ol' start of the SQL migrations system.
Things definitely don't work yet, but should be heading in the right direction.
Diffstat (limited to 'mediagoblin/db/sql/models.py')
-rw-r--r--mediagoblin/db/sql/models.py21
1 files changed, 21 insertions, 0 deletions
diff --git a/mediagoblin/db/sql/models.py b/mediagoblin/db/sql/models.py
index 9abd8ec7..3573bc3f 100644
--- a/mediagoblin/db/sql/models.py
+++ b/mediagoblin/db/sql/models.py
@@ -216,6 +216,27 @@ class MediaComment(Base):
get_author = relationship(User)
+MODELS = [
+ User, MediaEntry, Tag, MediaTag, MediaComment]
+
+
+######################################################
+# Special, migrations-tracking table
+#
+# Not listed in MODELS because this is special and not
+# really migrated, but used for migrations (for now)
+######################################################
+
+class MigrationData(Base):
+ __tablename__ = "migrations"
+
+ id = Column(Integer, primary_key=True)
+ name = Column(Unicode, nullable=False, unique=True)
+ version = Column(Integer, nullable=False, default=0)
+
+######################################################
+
+
def show_table_init():
from sqlalchemy import create_engine
engine = create_engine('sqlite:///:memory:', echo=True)