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