This repository has been archived on 2023-10-01. You can view files and clone it, but cannot push or open issues or pull requests.
PyNyaaTa/pynyaata/models.py

38 lines
1.1 KiB
Python
Raw Normal View History

2020-04-20 17:40:11 +00:00
from .config import db
2019-11-25 21:52:22 +00:00
class AnimeFolder(db.Model):
id = db.Column(db.Integer, primary_key=True)
2022-03-04 09:00:41 +00:00
name = db.Column(db.String(length=100), unique=True, nullable=False)
path = db.Column(db.String(length=100))
titles = db.relationship(
"AnimeTitle",
backref="folder",
cascade='all,delete-orphan'
)
2019-11-25 21:52:22 +00:00
class AnimeTitle(db.Model):
id = db.Column(db.Integer, primary_key=True)
2022-03-04 09:00:41 +00:00
name = db.Column(db.String(length=100), unique=True, nullable=False)
keyword = db.Column(db.Text(), nullable=False)
2019-11-30 22:42:35 +00:00
folder_id = db.Column(db.Integer, db.ForeignKey('anime_folder.id'))
links = db.relationship(
'AnimeLink',
backref="title",
cascade='all,delete-orphan'
)
2019-11-25 21:52:22 +00:00
class AnimeLink(db.Model):
id = db.Column(db.Integer, primary_key=True)
2022-03-04 09:00:41 +00:00
link = db.Column(db.Text(), nullable=False)
season = db.Column(db.Text(), nullable=False)
comment = db.Column(db.Text())
2019-11-25 21:52:22 +00:00
vf = db.Column(db.Boolean, nullable=False)
2019-11-30 22:42:35 +00:00
title_id = db.Column(db.Integer, db.ForeignKey('anime_title.id'))
2019-11-29 14:04:32 +00:00
2021-07-10 15:28:45 +00:00
def create_all():
db.create_all()