added missing foreign keys; removed unused tables
This commit is contained in:
parent
c89a4bc537
commit
b55792e5e3
|
@ -109,6 +109,8 @@ class Entry(Base):
|
|||
starts_at = Column(DateTime, nullable=False, default=datetime.now)
|
||||
ends_at = Column(DateTime)
|
||||
created_at = Column(DateTime, nullable=False, default=datetime.now)
|
||||
event_uid = Column(Integer, ForeignKey('event.uid'),
|
||||
nullable=False)
|
||||
|
||||
|
||||
class Event(Base):
|
||||
|
@ -118,6 +120,8 @@ class Event(Base):
|
|||
starts_at = Column(DateTime, nullable=False, default=datetime.now)
|
||||
ends_at = Column(DateTime)
|
||||
created_at = Column(DateTime, nullable=False, default=datetime.now)
|
||||
group_uid = Column(Integer, ForeignKey('group.uid'),
|
||||
nullable=False)
|
||||
|
||||
entries = relationship('Entry', lazy='joined')
|
||||
|
||||
|
@ -129,7 +133,7 @@ class Group(Base):
|
|||
description = Column(String, nullable=False)
|
||||
created_at = Column(DateTime, nullable=False, default=datetime.now)
|
||||
|
||||
products = relationship('Event', lazy='joined')
|
||||
events = relationship('Event', lazy='joined')
|
||||
|
||||
|
||||
class ProductCategory(Base):
|
||||
|
@ -154,25 +158,3 @@ class Product(Base):
|
|||
created_at = Column(DateTime, nullable=False, default=datetime.now)
|
||||
|
||||
category = relationship('ProductCategory', lazy='joined')
|
||||
|
||||
|
||||
class Transaction(Base):
|
||||
__tablename__ = 'transactions'
|
||||
uid = Column(Integer, primary_key=True)
|
||||
event_uid = Column(Integer, ForeignKey('events.uid'), nullable=False)
|
||||
created_at = Column(DateTime, nullable=False, default=datetime.now)
|
||||
|
||||
event = relationship('Event', lazy='joined')
|
||||
orders = relationship('Order', lazy='joined')
|
||||
|
||||
|
||||
class Order(Base):
|
||||
__tablename__ = 'orders'
|
||||
uid = Column(Integer, primary_key=True)
|
||||
product_uid = Column(Integer, ForeignKey('products.uid'), nullable=False)
|
||||
quantity = Column(Integer, nullable=False)
|
||||
transaction_uid = Column(Integer, ForeignKey(
|
||||
'transactions.uid'), nullable=False)
|
||||
|
||||
product = relationship('Product', lazy='joined')
|
||||
transaction = relationship('Transaction', lazy='joined')
|
||||
|
|
Loading…
Reference in New Issue
Block a user