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.
50 lines
1.3 KiB
Python
50 lines
1.3 KiB
Python
# from typing import List
|
|
from sqlalchemy import create_engine, Column, Integer, String, ForeignKey
|
|
from sqlalchemy.orm import relationship, declarative_base, sessionmaker
|
|
|
|
from .show import Base
|
|
|
|
from ffx.track_type import TrackType
|
|
|
|
from ffx.iso_language import IsoLanguage
|
|
|
|
from ffx.model.tag import Tag
|
|
|
|
|
|
|
|
class Track(Base):
|
|
"""
|
|
relationship(argument, opt1, opt2, ...)
|
|
argument is string of class or Mapped class of the target entity
|
|
backref creates a bi-directional corresponding relationship (back_populates preferred)
|
|
back_populates points to the corresponding relationship (the actual class attribute identifier)
|
|
|
|
See: https://docs.sqlalchemy.org/en/(14|20)/orm/basic_relationships.html
|
|
"""
|
|
|
|
__tablename__ = 'tracks'
|
|
|
|
# v1.x
|
|
id = Column(Integer, primary_key=True, autoincrement = True)
|
|
|
|
# P=pattern_id+sub_index+track_type
|
|
track_type = Column(Integer) # TrackType
|
|
sub_index = Column(Integer)
|
|
|
|
# v1.x
|
|
pattern_id = Column(Integer, ForeignKey('patterns.id', ondelete="CASCADE"))
|
|
pattern = relationship('Pattern', back_populates='tracks')
|
|
|
|
|
|
language = Column(String) # IsoLanguage threeLetter
|
|
title = Column(String)
|
|
|
|
tags = relationship('Tag', back_populates='track', cascade="all, delete")
|
|
|
|
|
|
disposition_flags = Column(Integer)
|
|
|
|
|
|
def getDescriptor(self):
|
|
pass
|