Database schema change. Minor database refactoring.

This commit is contained in:
crudo 2017-03-24 19:42:21 +01:00
parent 5db877dc4c
commit 9968cd2b8b

View File

@ -94,9 +94,9 @@ class User(Base):
uid = Column(Integer, primary_key=True)
username = Column(String, nullable=False, unique=True)
password = Column(PasswordType(schemes=PASSWORD_SCHEMES), nullable=False)
created_at = Column(DateTime, nullable=False, default=datetime.now)
is_active = Column(Boolean, nullable=False, server_default='1')
is_authenticated = Column(Boolean, nullable=False, server_default='0')
created_at = Column(DateTime, nullable=False, default=datetime.now)
def get_id(self):
return u'{}'.format(self.uid)
@ -106,9 +106,9 @@ class Event(Base):
__tablename__ = 'events'
uid = Column(Integer, primary_key=True)
name = Column(String, nullable=False)
created_at = Column(DateTime, nullable=False, default=datetime.now)
starts_at = Column(DateTime, nullable=False, default=datetime.now)
ends_at = Column(DateTime)
created_at = Column(DateTime, nullable=False, default=datetime.now)
transactions = relationship('Transaction', lazy='joined')
@ -119,8 +119,8 @@ class Product(Base):
name = Column(String, nullable=False)
price = Column(Integer, nullable=False)
sort = Column(Integer, nullable=False, server_default='0')
created_at = Column(DateTime, nullable=False, default=datetime.now)
is_active = Column(Boolean, nullable=False, server_default='1')
created_at = Column(DateTime, nullable=False, default=datetime.now)
order_entry_association = Table(
@ -133,8 +133,8 @@ order_entry_association = Table(
class Transaction(Base):
__tablename__ = 'transactions'
uid = Column(Integer, primary_key=True)
created_at = Column(DateTime, nullable=False, default=datetime.now)
event_uid = Column(Integer, ForeignKey('events.uid'), nullable=False)
created_at = Column(DateTime, nullable=False, default=datetime.now)
event = relationship('Event')
orders = relationship('Order', lazy='joined',