From 7e51efa9b079bea97f0aa0834c1297b619249d76 Mon Sep 17 00:00:00 2001 From: surtur Date: Fri, 7 Aug 2020 01:56:18 +0200 Subject: [PATCH] chore: aligning models and schemas complementary to 683586d --- app/models.py | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/app/models.py b/app/models.py index 367ca4b..13f8803 100644 --- a/app/models.py +++ b/app/models.py @@ -1,21 +1,21 @@ from sqlalchemy import Boolean, Column, ForeignKey, Integer, String, Float from sqlalchemy.orm import relationship -from .database import Base +from app.database import Base class Service(Base): __tablename__ = "service" id = Column(Integer, primary_key=True, index=True) name = Column(String, index=True) + owner_id = Column(Integer, ForeignKey("user.id"), index=True) is_private = Column(Boolean, default=True) - description = Column(String) + description = Column(String, default=None) service_type = Column(Integer) url = Column(String) - owner_id = Column(Integer, ForeignKey("user.id"), index=True) is_active = Column(Boolean, default=True, index=True) created_unix = Column(Float) - updated_unix = Column(Float) + updated_unix = Column(Float, default=None) user = relationship("User", back_populates="service") @@ -27,9 +27,10 @@ class User(Base): name = Column(String, unique=True, index=True) full_name = Column(String, index=True) password = Column(String) - is_active = Column(Boolean, default=True, index=True) + is_active = Column(Boolean, index=True) 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")