-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathmodels.py
More file actions
71 lines (58 loc) · 2.2 KB
/
models.py
File metadata and controls
71 lines (58 loc) · 2.2 KB
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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
from datetime import datetime # ใช้ datetime จาก Python เองสำหรับเวลาปัจจุบัน
from sqlalchemy import Column, ForeignKey, Integer, String, Float, Boolean, DateTime # นำเข้า Boolean และ DateTime จาก SQLAlchemy
from sqlalchemy.ext.declarative import declarative_base
Base = declarative_base()
class Building(Base):
__tablename__ = 'building'
id = Column(Integer, primary_key=True, index=True)
code = Column(String, index=True)
name = Column(String, index=True)
area = Column(String, index=True)
class Unit(Base):
__tablename__ = 'unit'
id = Column(Integer, primary_key=True, index=True)
years = Column(Integer)
month = Column(Integer)
amount = Column(Integer)
idBuilding = Column(Integer, ForeignKey('building.id'))
class NumberOfUsers(Base):
__tablename__ = 'numberOfUsers'
id = Column(Integer, primary_key=True, index=True)
years = Column(Integer)
month = Column(Integer)
amount = Column(Integer)
class ExamStatus(Base):
__tablename__ = 'examStatus'
id = Column(Integer, primary_key=True, index=True)
years = Column(Integer)
month = Column(Integer)
status = Column(Boolean)
class SemesterStatus(Base):
__tablename__ = 'semesterStatus'
id = Column(Integer, primary_key=True, index=True)
years = Column(Integer)
month = Column(Integer)
status = Column(Boolean)
class Member(Base):
__tablename__ = 'member'
id = Column(Integer, primary_key=True, index=True)
username = Column(String, unique=True, index=True)
password = Column(String)
fname = Column(String)
lname = Column(String)
email = Column(String)
phone = Column(String)
status = Column(Integer)
class PredictionTable(Base):
__tablename__ = "predictiontable"
id = Column(Integer, primary_key=True, index=True)
building = Column(String, index=True)
area = Column(Float)
prediction = Column(Float)
unit = Column(Float)
modelName = Column(String)
month_current = Column(Integer)
year_current = Column(Integer)
month_predict = Column(Integer)
year_predict = Column(Integer)
created_at = Column(DateTime, default=datetime.utcnow)