diff options
author | Elrond <elrond+mediagoblin.org@samba-tng.org> | 2011-12-15 22:11:49 +0100 |
---|---|---|
committer | Elrond <elrond+mediagoblin.org@samba-tng.org> | 2011-12-15 22:11:49 +0100 |
commit | e365f980ac21a403a50f61ae687d7dc04760f8bb (patch) | |
tree | 3387f3ac3fdd3bf9eb3e273327f352173051f4cf /mediagoblin/db/sql/models.py | |
parent | a8ae9a29c1434f10e22262f3c66637977fe3b713 (diff) | |
download | mediagoblin-e365f980ac21a403a50f61ae687d7dc04760f8bb.tar.lz mediagoblin-e365f980ac21a403a50f61ae687d7dc04760f8bb.tar.xz mediagoblin-e365f980ac21a403a50f61ae687d7dc04760f8bb.zip |
SQL: Some toys and little fix
Run bin/python mediagoblin/db/sql/models.py and watch the
create tables on a memory sqlite db.
Also unicode strings need unicode defauls. Warning by
sqlalchemy.
Diffstat (limited to 'mediagoblin/db/sql/models.py')
-rw-r--r-- | mediagoblin/db/sql/models.py | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/mediagoblin/db/sql/models.py b/mediagoblin/db/sql/models.py index 31ebfbf4..a38be1cc 100644 --- a/mediagoblin/db/sql/models.py +++ b/mediagoblin/db/sql/models.py @@ -18,7 +18,7 @@ class User(Base): created = Column(DateTime, nullable=False, default=datetime.datetime.now) pw_hash = Column(Unicode, nullable=False) email_verified = Column(Boolean) - status = Column(Unicode, default="needs_email_verification", nullable=False) + status = Column(Unicode, default=u"needs_email_verification", nullable=False) verification_key = Column(Unicode) is_admin = Column(Boolean, default=False, nullable=False) url = Column(Unicode) @@ -93,3 +93,14 @@ class MediaComment(Base): created = Column(DateTime, nullable=False, default=datetime.datetime.now) content = Column(UnicodeText, nullable=False) content_html = Column(UnicodeText) + + +def show_table_init(): + from sqlalchemy import create_engine + engine = create_engine('sqlite:///:memory:', echo=True) + + Base.metadata.create_all(engine) + + +if __name__ == '__main__': + show_table_init() |