pripravil db za presistent state deck stuff

master
Kostanjevec 2022-06-04 22:18:21 +02:00
parent 91ae04a924
commit c5d71802ac
1 changed files with 14 additions and 19 deletions

View File

@ -3,11 +3,13 @@
from csv import unregister_dialect
#import email
from sqlite3 import Date
from xmlrpc.client import Boolean
from click import password_option
from pymysql import Timestamp
#from ssl import _PasswordType
#from xmlrpc.client import DateTime
#from matplotlib.pyplot import title
from sqlalchemy import Column, Integer, Float, String, Text, TIMESTAMP,ForeignKey
from sqlalchemy import Column, Integer, Float, String, Text, TIMESTAMP,ForeignKey, BOOLEAN
from sqlalchemy.ext.declarative import declarative_base
#from sqlalchemy.orm import relationship
from sqlalchemy import func, create_engine,join
@ -33,6 +35,17 @@ class Card(Base):
owner_id = Column(Integer, ForeignKey("user.id"), nullable=False)
interest_rate = Column(Float)
item_location = Column(String(1024))
#shared = Column(BOOLEAN) #tu bo že problem, ker
#last_review = Column(TIMESTAMP)
class Deck(Base):
__tablename__ = 'deck'
id = Column(Integer, primary_key=True, autoincrement=True)
cards_by_id = Column(Text)
number_of_cards = Column(Integer)
current_card = Column(Integer)
completed = Column(BOOLEAN)
# shared = Column(Bool)
# item_type = Column(String)
@ -44,24 +57,6 @@ class Card(Base):
# interval = Column(Integer)
# due = Column(DateTime)
"""
class Card(Base):
item_id = None
user_id = None
deck_id = None # generated session id
timestamp = None
interest_rate = Column(Float)
"""
engine = create_engine(CONFIG['DB_CONNECTION'])
Base.metadata.create_all(engine)