-
Notifications
You must be signed in to change notification settings - Fork 3
/
models.py
47 lines (31 loc) · 1.35 KB
/
models.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
from flask_sqlalchemy import SQLAlchemy
from flask_login import UserMixin
db = SQLAlchemy()
class User(UserMixin, db.Model):
id = db.Column(db.Integer, primary_key=True)
username = db.Column(db.String(220), unique=True, nullable=False)
def __repr__(self):
return '<User %r>' % self.username
class Group(db.Model):
id = db.Column(db.Integer, primary_key=True)
name = db.Column(db.String(220), unique=True, nullable=False)
def __repr__(self):
return '<Group %r>' % self.name
class ManyUserGroup(db.Model):
id = db.Column(db.Integer, primary_key=True)
user = db.Column(db.Integer, db.ForeignKey('user.id'), nullable=False)
group = db.Column(db.Integer, db.ForeignKey('group.id'), nullable=False)
def __repr__(self):
return '<Many %d>' % self.id
class KG(db.Model):
id = db.Column(db.Integer, primary_key=True)
name = db.Column(db.String(220), unique=False, nullable=False)
group = db.Column(db.Integer, db.ForeignKey('group.id'), nullable=False)
def __repr__(self):
return '<KG %r>' % self.name
class Ontology(db.Model):
id = db.Column(db.Integer, primary_key=True)
name = db.Column(db.String(220), unique=False, nullable=False)
group = db.Column(db.Integer, db.ForeignKey('group.id'), nullable=False)
def __repr__(self):
return '<Ontology %r>' % self.name