generated from Luis/nextjs-python-web-template
24 lines
621 B
Python
24 lines
621 B
Python
from sqlalchemy import JSON, Column, ForeignKey, Integer
|
|
from sqlalchemy.orm import relationship
|
|
|
|
from .sql_db import Base
|
|
|
|
|
|
class Producer(Base):
|
|
__tablename__ = "producers"
|
|
|
|
id = Column(Integer, primary_key=True, index=True)
|
|
jsonblob = Column(JSON)
|
|
|
|
repos = relationship("Repository", back_populates="producer")
|
|
|
|
|
|
class Repository(Base):
|
|
__tablename__ = "repositories"
|
|
|
|
id = Column(Integer, primary_key=True, index=True)
|
|
jsonblob = Column(JSON)
|
|
prod_id = Column(Integer, ForeignKey("producers.id"))
|
|
|
|
producer = relationship("Producer", back_populates="repos")
|