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 #!/usr/bin/python3
from csv import unregister_dialect from sqlalchemy import Column, Integer, Float, String, Text, Date, ForeignKey, BOOLEAN
#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.ext.declarative import declarative_base from sqlalchemy.ext.declarative import declarative_base
#from sqlalchemy.orm import relationship from sqlalchemy import create_engine
from sqlalchemy import func, create_engine,join
from sqlalchemy.orm import sessionmaker from sqlalchemy.orm import sessionmaker
from config import CONFIG from config import CONFIG
@ -46,15 +36,13 @@ class Deck(Base):
current_card = Column(Integer) current_card = Column(Integer)
completed = Column(BOOLEAN) completed = Column(BOOLEAN)
""" class Rating(Base):
class Review(Base): __tablename__ = 'rating'
__tablename__ = 'review'
id = Column(Integer, primary_key=True, autoincrement=True) id = Column(Integer, primary_key=True, autoincrement=True)
reviewer_id = Column(Integer, ForeignKey("user.id"), nullable=False) user_id = Column(Integer, ForeignKey("user.id"), nullable=False)
card_id = Column(Integer, ForeignKey("user.id"), nullable=False) card_id = Column(Integer, ForeignKey("card.id"), nullable=False)
review = Column(Text) rating_value = Column(Text) #Yes, Maybe, No
time = Column(DateTime) rating_time = Column(Date)
"""
engine = create_engine(CONFIG['DB_CONNECTION']) engine = create_engine(CONFIG['DB_CONNECTION'])