-
Notifications
You must be signed in to change notification settings - Fork 0
/
dbModels.py
23 lines (22 loc) · 874 Bytes
/
dbModels.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
from sqlalchemy import Column, ForeignKey, Integer, String, Text
from sqlalchemy.orm import relationship,declarative_base
from flask_login import UserMixin
from . import db
class User(UserMixin,db.Model) :
__tablename__ = 'user'
id = db.Column(db.Integer,primary_key = True)
email = db.Column(db.String(100),unique = True)
password = db.Column(db.String(100))
name = db.Column(db.String(100))
codes = relationship("CodeData")
dataSets = relationship("DataSet")
class CodeData(UserMixin,db.Model):
id = Column(Integer,primary_key = True)
user_id = Column(Integer,ForeignKey("user.id"))
codeName = Column(String(100))
code = Column(Text)
class DataSet(UserMixin,db.Model):
id = Column(Integer,primary_key = True)
user_id = Column(Integer,ForeignKey("user.id"))
codeName = Column(String(100))
code = Column(Text)