added a Base for ratings
parent
af84024889
commit
73091938e9
28
create_db.py
28
create_db.py
|
@ -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'])
|
||||
|
||||
|
|
Loading…
Reference in New Issue