You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
25 lines
755 B
Python
25 lines
755 B
Python
from sqlalchemy import create_engine, Column, Integer, String, ForeignKey
|
|
from sqlalchemy.orm import relationship, sessionmaker, Mapped
|
|
|
|
from .show import Base
|
|
|
|
class Pattern(Base):
|
|
|
|
__tablename__ = 'patterns'
|
|
|
|
# v1.x
|
|
id = Column(Integer, primary_key=True)
|
|
pattern = Column(String)
|
|
|
|
# v2.0
|
|
# id: Mapped[int] = mapped_column(Integer, primary_key=True)
|
|
# pattern: Mapped[str] = mapped_column(String, nullable=False)
|
|
|
|
# v1.x
|
|
show_id = Column(Integer, ForeignKey('shows.id', ondelete="CASCADE"))
|
|
show = relationship('Show', back_populates='patterns')
|
|
|
|
# v2.0
|
|
# show_id: Mapped[int] = mapped_column(ForeignKey("shows.id", ondelete="CASCADE"))
|
|
# show: Mapped["Show"] = relationship(back_populates="patterns")
|