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

30 lines
1.2 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)
2020-03-21 18:03:57 +00:00
name = db.Column(db.String(length=100, collation='utf8mb4_general_ci'), unique=True, nullable=False)
2021-07-10 15:28:45 +00:00
path = db.Column(db.String(length=100, collation='utf8mb4_general_ci'))
2021-07-10 18:59:36 +00:00
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)
2020-03-21 18:03:57 +00:00
name = db.Column(db.String(length=100, collation='utf8mb4_general_ci'), unique=True, nullable=False)
2019-12-15 12:02:13 +00:00
keyword = db.Column(db.Text(collation='utf8mb4_general_ci'), nullable=False)
2019-11-30 22:42:35 +00:00
folder_id = db.Column(db.Integer, db.ForeignKey('anime_folder.id'))
2021-07-10 18:59:36 +00:00
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)
2019-12-15 12:02:13 +00:00
link = db.Column(db.Text(collation='utf8mb4_general_ci'), nullable=False)
season = db.Column(db.Text(collation='utf8mb4_general_ci'), nullable=False)
comment = db.Column(db.Text(collation='utf8mb4_general_ci'))
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()