chore: aligning models and schemas

complementary to 683586d
This commit is contained in:
surtur 2020-08-07 01:56:18 +02:00
parent 683586d6f0
commit 7e51efa9b0
Signed by: wanderer
GPG Key ID: 19CE1EC1D9E0486D

@ -1,21 +1,21 @@
from sqlalchemy import Boolean, Column, ForeignKey, Integer, String, Float from sqlalchemy import Boolean, Column, ForeignKey, Integer, String, Float
from sqlalchemy.orm import relationship from sqlalchemy.orm import relationship
from .database import Base from app.database import Base
class Service(Base): class Service(Base):
__tablename__ = "service" __tablename__ = "service"
id = Column(Integer, primary_key=True, index=True) id = Column(Integer, primary_key=True, index=True)
name = Column(String, index=True) name = Column(String, index=True)
owner_id = Column(Integer, ForeignKey("user.id"), index=True)
is_private = Column(Boolean, default=True) is_private = Column(Boolean, default=True)
description = Column(String) description = Column(String, default=None)
service_type = Column(Integer) service_type = Column(Integer)
url = Column(String) url = Column(String)
owner_id = Column(Integer, ForeignKey("user.id"), index=True)
is_active = Column(Boolean, default=True, index=True) is_active = Column(Boolean, default=True, index=True)
created_unix = Column(Float) created_unix = Column(Float)
updated_unix = Column(Float) updated_unix = Column(Float, default=None)
user = relationship("User", back_populates="service") user = relationship("User", back_populates="service")
@ -27,9 +27,10 @@ class User(Base):
name = Column(String, unique=True, index=True) name = Column(String, unique=True, index=True)
full_name = Column(String, index=True) full_name = Column(String, index=True)
password = Column(String) password = Column(String)
is_active = Column(Boolean, default=True, index=True) is_active = Column(Boolean, index=True)
created_unix = Column(Float) created_unix = Column(Float)
last_login_unix = Column(Float) updated_unix = Column(Float, default=None)
last_login_unix = Column(Float, default=None)
service = relationship("Service", back_populates="user") service = relationship("Service", back_populates="user")