added a Base for ratings

master
Kostanjevec 2022-08-07 16:35:28 +02:00
parent af84024889
commit 73091938e9
1 changed files with 8 additions and 20 deletions

View File

@ -1,18 +1,8 @@
#!/usr/bin/python3
from csv import unregister_dialect
#import email
from sqlite3 import Date
from xmlrpc.client import Boolean
from click import password_option
from pymysql import Time, Timestamp
#from ssl import _PasswordType
#from xmlrpc.client import DateTime
#from matplotlib.pyplot import title
from sqlalchemy import Column, Integer, Float, String, Text, DateTime, ForeignKey, BOOLEAN
from sqlalchemy import Column, Integer, Float, String, Text, Date, ForeignKey, BOOLEAN
from sqlalchemy.ext.declarative import declarative_base
#from sqlalchemy.orm import relationship
from sqlalchemy import func, create_engine,join
from sqlalchemy import create_engine
from sqlalchemy.orm import sessionmaker
from config import CONFIG
@ -46,15 +36,13 @@ class Deck(Base):
current_card = Column(Integer)
completed = Column(BOOLEAN)
"""
class Review(Base):
__tablename__ = 'review'
class Rating(Base):
__tablename__ = 'rating'
id = Column(Integer, primary_key=True, autoincrement=True)
reviewer_id = Column(Integer, ForeignKey("user.id"), nullable=False)
card_id = Column(Integer, ForeignKey("user.id"), nullable=False)
review = Column(Text)
time = Column(DateTime)
"""
user_id = Column(Integer, ForeignKey("user.id"), nullable=False)
card_id = Column(Integer, ForeignKey("card.id"), nullable=False)
rating_value = Column(Text) #Yes, Maybe, No
rating_time = Column(Date)
engine = create_engine(CONFIG['DB_CONNECTION'])