sql_app: db: enforece not-null
Signed-off-by: HeshamTB <hishaminv@gmail.com>
This commit is contained in:
parent
9a7e6a288f
commit
22ecea44f6
@ -8,11 +8,11 @@ class User(Base):
|
|||||||
__tablename__ = "user_accounts"
|
__tablename__ = "user_accounts"
|
||||||
|
|
||||||
id = Column(Integer, primary_key=True, index=True)
|
id = Column(Integer, primary_key=True, index=True)
|
||||||
email = Column(String, unique=True, index=True)
|
email = Column(String, unique=True, index=True, nullable=False)
|
||||||
username = Column(String, unique=True, index=True)
|
username = Column(String, unique=True, index=True, nullable=False)
|
||||||
hashed_password = Column(String) # TODO: make not null
|
hashed_password = Column(String, nullable=False)
|
||||||
passwd_salt = Column(String)
|
passwd_salt = Column(String, nullable=False)
|
||||||
is_active = Column(Boolean, default=True)
|
is_active = Column(Boolean, default=True, nullable=False)
|
||||||
|
|
||||||
authorized_devices = relationship("IotEntity", secondary= 'user_iot_link')
|
authorized_devices = relationship("IotEntity", secondary= 'user_iot_link')
|
||||||
|
|
||||||
@ -21,8 +21,8 @@ class IotEntity(Base):
|
|||||||
__tablename__ = "iot_entities"
|
__tablename__ = "iot_entities"
|
||||||
|
|
||||||
id = Column(Integer, primary_key=True, index=True)
|
id = Column(Integer, primary_key=True, index=True)
|
||||||
bluetooth_mac = Column(String)
|
bluetooth_mac = Column(String(512))
|
||||||
description = Column(String, index=True)
|
description = Column(String(512))
|
||||||
|
|
||||||
authorized_users = relationship("User", secondary= 'user_iot_link')
|
authorized_users = relationship("User", secondary= 'user_iot_link')
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user