# HG changeset patch # User Marcin Kuzminski # Date 2010-04-10 14:29:25 # Node ID 1b6d7662d6e26d4e625d9a9fae4911e3d1da97e2 # Parent eb0268a891876c4fabe791fa806b10de9f8e4198 Updated database model, with FK and Booleans diff --git a/pylons_app/model/db.py b/pylons_app/model/db.py --- a/pylons_app/model/db.py +++ b/pylons_app/model/db.py @@ -12,13 +12,15 @@ class Users(Base): user_id = Column("user_id", SLInteger(), nullable=False, unique=True, default=None, primary_key=1) username = Column("username", SLText(length=None, convert_unicode=False, assert_unicode=None), nullable=True, unique=None, default=None) password = Column("password", SLText(length=None, convert_unicode=False, assert_unicode=None), nullable=True, unique=None, default=None) - active = Column("active", SLInteger(), nullable=True, unique=None, default=None) - admin = Column("admin", SLInteger(), nullable=True, unique=None, default=None) - + active = Column("active", SLBoolean(), nullable=True, unique=None, default=None) + admin = Column("admin", SLBoolean(), nullable=True, unique=None, default=None) + action_log = relation('UserLogs') + class UserLogs(Base): __tablename__ = 'user_logs' __table_args__ = {'useexisting':True} id = Column("id", SLInteger(), nullable=False, unique=True, default=None, primary_key=1) - user_id = Column("user_id", SLInteger(), nullable=True, unique=None, default=None) + user_id = Column("user_id", SLInteger(), ForeignKey(u'users.user_id'), nullable=True, unique=None, default=None) last_action = Column("last_action", SLText(length=None, convert_unicode=False, assert_unicode=None), nullable=True, unique=None, default=None) last_action_date = Column("last_action_date", SLDateTime(timezone=False), nullable=True, unique=None, default=None) + user = relation('Users')