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)
|
2021-09-01 15:57:54 +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-09-01 15:57:54 +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)
|
2021-09-01 15:57:54 +00:00
|
|
|
name = db.Column(db.String(
|
|
|
|
length=100,
|
|
|
|
collation='utf8mb4_general_ci'
|
|
|
|
), unique=True, nullable=False)
|
|
|
|
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-09-01 15:57:54 +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()
|