Upgrade to Pylons 1.0. #283
[zzz-spline-users.git] / migration / versions / 001_Add_user_and_openid_tables.py
1 from sqlalchemy import *
2 from migrate import *
3
4 from sqlalchemy.ext.declarative import declarative_base
5 TableBase = declarative_base(bind=migrate_engine)
6
7
8 class User(TableBase):
9 __tablename__ = 'users'
10 id = Column(Integer, primary_key=True)
11 name = Column(Unicode(length=20), nullable=False)
12
13 class OpenID(TableBase):
14 __tablename__ = 'openid'
15 openid = Column(Unicode(length=255), primary_key=True)
16 user_id = Column(Integer, ForeignKey('users.id'))
17
18
19 def upgrade():
20 User.__table__.create()
21 OpenID.__table__.create()
22
23 def downgrade():
24 OpenID.__table__.drop()
25 User.__table__.drop()