f51282cecf2c26da31039f91cb0add5caa22cf3e
[zzz-floof.git] / floof / model / users.py
1 from sqlalchemy import Column, ForeignKey
2 from sqlalchemy.orm import relation
3 from sqlalchemy.types import Integer, Unicode
4
5 from floof.model import meta
6
7 __all__ = ['User', 'IdentityURL']
8
9 class User(meta.TableBase):
10 __tablename__ = 'users'
11 id = Column(Integer, primary_key=True)
12 name = Column(Unicode(length=20), nullable=False)
13
14 class IdentityURL(meta.TableBase):
15 __tablename__ = 'identity_urls'
16 url = Column(Unicode(length=255), primary_key=True)
17 user_id = Column(Integer, ForeignKey('users.id'))
18
19 IdentityURL.user = relation(User, lazy=False, backref="identity_urls")