-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathidentityManagement.py
45 lines (36 loc) · 1.34 KB
/
identityManagement.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
from sqlalchemy import *
from sqlalchemy import create_engine, ForeignKey
from sqlalchemy import Column, Date, Integer, String
from sqlalchemy.ext.declarative import declarative_base
from sqlalchemy.orm import relationship, backref
engine = create_engine('sqlite:///identityManagement.db', echo=True)
Base = declarative_base()
########################################################################
class User(Base):
""""""
__tablename__ = "users"
id = Column(Integer, primary_key=True)
username = Column(String)
password = Column(String)
salt = Column(String)
#----------------------------------------------------------------------
def __init__(self, username, password):
""""""
self.username = username
self.password = password
########################################################################
class Company(Base):
""""""
__tablename__ = "companies"
id = Column(Integer, primary_key=True)
companyName = Column(String)
termsLimit = Column(Integer)
########################################################################
class UsersCompany(Base):
""""""
__tablename__ = "usersCompany"
id = Column(Integer, primary_key=True)
userID = Column(Integer, ForeignKey('users.id'))
companyID = Column(Integer, ForeignKey('companies.id'))
# create tables
Base.metadata.create_all(engine)