forked from crudo/macao-pos
Database schema change. Minor database refactoring.
This commit is contained in:
parent
b93478ac85
commit
729402ef6d
|
@ -94,9 +94,9 @@ class User(Base):
|
||||||
uid = Column(Integer, primary_key=True)
|
uid = Column(Integer, primary_key=True)
|
||||||
username = Column(String, nullable=False, unique=True)
|
username = Column(String, nullable=False, unique=True)
|
||||||
password = Column(PasswordType(schemes=PASSWORD_SCHEMES), nullable=False)
|
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_active = Column(Boolean, nullable=False, server_default='1')
|
||||||
is_authenticated = Column(Boolean, nullable=False, server_default='0')
|
is_authenticated = Column(Boolean, nullable=False, server_default='0')
|
||||||
|
created_at = Column(DateTime, nullable=False, default=datetime.now)
|
||||||
|
|
||||||
def get_id(self):
|
def get_id(self):
|
||||||
return u'{}'.format(self.uid)
|
return u'{}'.format(self.uid)
|
||||||
|
@ -106,9 +106,9 @@ class Event(Base):
|
||||||
__tablename__ = 'events'
|
__tablename__ = 'events'
|
||||||
uid = Column(Integer, primary_key=True)
|
uid = Column(Integer, primary_key=True)
|
||||||
name = Column(String, nullable=False)
|
name = Column(String, nullable=False)
|
||||||
created_at = Column(DateTime, nullable=False, default=datetime.now)
|
|
||||||
starts_at = Column(DateTime, nullable=False, default=datetime.now)
|
starts_at = Column(DateTime, nullable=False, default=datetime.now)
|
||||||
ends_at = Column(DateTime)
|
ends_at = Column(DateTime)
|
||||||
|
created_at = Column(DateTime, nullable=False, default=datetime.now)
|
||||||
|
|
||||||
transactions = relationship('Transaction', lazy='joined')
|
transactions = relationship('Transaction', lazy='joined')
|
||||||
|
|
||||||
|
@ -119,8 +119,8 @@ class Product(Base):
|
||||||
name = Column(String, nullable=False)
|
name = Column(String, nullable=False)
|
||||||
price = Column(Integer, nullable=False)
|
price = Column(Integer, nullable=False)
|
||||||
sort = Column(Integer, nullable=False, server_default='0')
|
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')
|
is_active = Column(Boolean, nullable=False, server_default='1')
|
||||||
|
created_at = Column(DateTime, nullable=False, default=datetime.now)
|
||||||
|
|
||||||
|
|
||||||
order_entry_association = Table(
|
order_entry_association = Table(
|
||||||
|
@ -133,8 +133,8 @@ order_entry_association = Table(
|
||||||
class Transaction(Base):
|
class Transaction(Base):
|
||||||
__tablename__ = 'transactions'
|
__tablename__ = 'transactions'
|
||||||
uid = Column(Integer, primary_key=True)
|
uid = Column(Integer, primary_key=True)
|
||||||
created_at = Column(DateTime, nullable=False, default=datetime.now)
|
|
||||||
event_uid = Column(Integer, ForeignKey('events.uid'), nullable=False)
|
event_uid = Column(Integer, ForeignKey('events.uid'), nullable=False)
|
||||||
|
created_at = Column(DateTime, nullable=False, default=datetime.now)
|
||||||
|
|
||||||
event = relationship('Event')
|
event = relationship('Event')
|
||||||
orders = relationship('Order', lazy='joined',
|
orders = relationship('Order', lazy='joined',
|
||||||
|
|
Loading…
Reference in New Issue
Block a user