From 9968cd2b8b047257f5f6474f5b657c5eb67c4e87 Mon Sep 17 00:00:00 2001 From: crudo Date: Fri, 24 Mar 2017 19:42:21 +0100 Subject: [PATCH] Database schema change. Minor database refactoring. --- pos/database.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/pos/database.py b/pos/database.py index 4491905..6e17049 100644 --- a/pos/database.py +++ b/pos/database.py @@ -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',