##// END OF EJS Templates
Updated database model, with FK and Booleans
Marcin Kuzminski -
r61:1b6d7662 default
parent child Browse files
Show More
@@ -1,24 +1,26
1 1 from sqlalchemy.ext.declarative import declarative_base
2 2 from sqlalchemy.orm import relation, backref
3 3 from sqlalchemy import ForeignKey, Column, Table, Sequence
4 4 from sqlalchemy.types import *
5 5 from sqlalchemy.databases.sqlite import *
6 6 from pylons_app.model.meta import Base
7 7
8 8
9 9 class Users(Base):
10 10 __tablename__ = 'users'
11 11 __table_args__ = {'useexisting':True}
12 12 user_id = Column("user_id", SLInteger(), nullable=False, unique=True, default=None, primary_key=1)
13 13 username = Column("username", SLText(length=None, convert_unicode=False, assert_unicode=None), nullable=True, unique=None, default=None)
14 14 password = Column("password", SLText(length=None, convert_unicode=False, assert_unicode=None), nullable=True, unique=None, default=None)
15 active = Column("active", SLInteger(), nullable=True, unique=None, default=None)
16 admin = Column("admin", SLInteger(), nullable=True, unique=None, default=None)
17
15 active = Column("active", SLBoolean(), nullable=True, unique=None, default=None)
16 admin = Column("admin", SLBoolean(), nullable=True, unique=None, default=None)
17 action_log = relation('UserLogs')
18
18 19 class UserLogs(Base):
19 20 __tablename__ = 'user_logs'
20 21 __table_args__ = {'useexisting':True}
21 22 id = Column("id", SLInteger(), nullable=False, unique=True, default=None, primary_key=1)
22 user_id = Column("user_id", SLInteger(), nullable=True, unique=None, default=None)
23 user_id = Column("user_id", SLInteger(), ForeignKey(u'users.user_id'), nullable=True, unique=None, default=None)
23 24 last_action = Column("last_action", SLText(length=None, convert_unicode=False, assert_unicode=None), nullable=True, unique=None, default=None)
24 25 last_action_date = Column("last_action_date", SLDateTime(timezone=False), nullable=True, unique=None, default=None)
26 user = relation('Users')
General Comments 0
You need to be logged in to leave comments. Login now