from sqlalchemy_utils import UUIDType

from zou.app import db
from zou.app.models.serializer import SerializerMixin
from zou.app.models.base import BaseMixin


class WorkingFile(db.Model, BaseMixin, SerializerMixin):
    shotgun_id = db.Column(db.Integer())

    name = db.Column(db.String(250))
    description = db.Column(db.String(200))
    comment = db.Column(db.Text())
    revision = db.Column(db.Integer())
    size = db.Column(db.Integer())
    checksum = db.Column(db.Integer())

    task_id = db.Column(UUIDType(binary=False), db.ForeignKey("task.id"))
    entity_id = db.Column(UUIDType(binary=False), db.ForeignKey("entity.id"))
    person_id = \
        db.Column(UUIDType(binary=False), db.ForeignKey("person.id"))

    __table_args__ = (
        db.UniqueConstraint(
            "name",
            "task_id",
            "entity_id",
            "revision",
            name="working_file_uc"
        ),
    )

    def __repr__(self):
        return "<WorkingFile %s>" % self.id

from sqlalchemy.orm import relationship
from sqlalchemy_utils import UUIDType

from zou.app import db
from zou.app.models.serializer import SerializerMixin
from zou.app.models.base import BaseMixin


class WorkingFile(db.Model, BaseMixin, SerializerMixin):
    shotgun_id = db.Column(db.Integer())

    name = db.Column(db.String(250))
    description = db.Column(db.String(200))
    comment = db.Column(db.Text())
    revision = db.Column(db.Integer())
    size = db.Column(db.Integer())
    checksum = db.Column(db.Integer())
    path = db.Column(db.String(400))

    task_id = db.Column(UUIDType(binary=False), db.ForeignKey("task.id"))
    entity_id = db.Column(UUIDType(binary=False), db.ForeignKey("entity.id"))
    person_id = \
        db.Column(UUIDType(binary=False), db.ForeignKey("person.id"))
    software_id = \
        db.Column(UUIDType(binary=False), db.ForeignKey("software.id"))
    outputs = relationship(
        "OutputFile",
        back_populates="source_file"
    )

    __table_args__ = (
        db.UniqueConstraint(
            "name",
            "task_id",
            "entity_id",
            "revision",
            name="working_file_uc"
        ),
    )

    def __repr__(self):
        return "<WorkingFile %s>" % self.id

Add fields to working file model
Add fields to working file model

* Software
* List of output files generated
* Path used to store the working file

+ from sqlalchemy.orm import relationship
  from sqlalchemy_utils import UUIDType
  
  from zou.app import db
  from zou.app.models.serializer import SerializerMixin
  from zou.app.models.base import BaseMixin
  
  
  class WorkingFile(db.Model, BaseMixin, SerializerMixin):
      shotgun_id = db.Column(db.Integer())
  
      name = db.Column(db.String(250))
      description = db.Column(db.String(200))
      comment = db.Column(db.Text())
      revision = db.Column(db.Integer())
      size = db.Column(db.Integer())
      checksum = db.Column(db.Integer())
+     path = db.Column(db.String(400))
  
      task_id = db.Column(UUIDType(binary=False), db.ForeignKey("task.id"))
      entity_id = db.Column(UUIDType(binary=False), db.ForeignKey("entity.id"))
      person_id = \
          db.Column(UUIDType(binary=False), db.ForeignKey("person.id"))
+     software_id = \
+         db.Column(UUIDType(binary=False), db.ForeignKey("software.id"))
+     outputs = relationship(
+         "OutputFile",
+         back_populates="source_file"
+     )
  
      __table_args__ = (
          db.UniqueConstraint(
              "name",
              "task_id",
              "entity_id",
              "revision",
              name="working_file_uc"
          ),
      )
  
      def __repr__(self):
          return "<WorkingFile %s>" % self.id
  
Add fields to working file model
## Code Before:
from sqlalchemy_utils import UUIDType

from zou.app import db
from zou.app.models.serializer import SerializerMixin
from zou.app.models.base import BaseMixin


class WorkingFile(db.Model, BaseMixin, SerializerMixin):
    shotgun_id = db.Column(db.Integer())

    name = db.Column(db.String(250))
    description = db.Column(db.String(200))
    comment = db.Column(db.Text())
    revision = db.Column(db.Integer())
    size = db.Column(db.Integer())
    checksum = db.Column(db.Integer())

    task_id = db.Column(UUIDType(binary=False), db.ForeignKey("task.id"))
    entity_id = db.Column(UUIDType(binary=False), db.ForeignKey("entity.id"))
    person_id = \
        db.Column(UUIDType(binary=False), db.ForeignKey("person.id"))

    __table_args__ = (
        db.UniqueConstraint(
            "name",
            "task_id",
            "entity_id",
            "revision",
            name="working_file_uc"
        ),
    )

    def __repr__(self):
        return "<WorkingFile %s>" % self.id

## Instruction:
Add fields to working file model
## Code After:
from sqlalchemy.orm import relationship
from sqlalchemy_utils import UUIDType

from zou.app import db
from zou.app.models.serializer import SerializerMixin
from zou.app.models.base import BaseMixin


class WorkingFile(db.Model, BaseMixin, SerializerMixin):
    shotgun_id = db.Column(db.Integer())

    name = db.Column(db.String(250))
    description = db.Column(db.String(200))
    comment = db.Column(db.Text())
    revision = db.Column(db.Integer())
    size = db.Column(db.Integer())
    checksum = db.Column(db.Integer())
    path = db.Column(db.String(400))

    task_id = db.Column(UUIDType(binary=False), db.ForeignKey("task.id"))
    entity_id = db.Column(UUIDType(binary=False), db.ForeignKey("entity.id"))
    person_id = \
        db.Column(UUIDType(binary=False), db.ForeignKey("person.id"))
    software_id = \
        db.Column(UUIDType(binary=False), db.ForeignKey("software.id"))
    outputs = relationship(
        "OutputFile",
        back_populates="source_file"
    )

    __table_args__ = (
        db.UniqueConstraint(
            "name",
            "task_id",
            "entity_id",
            "revision",
            name="working_file_uc"
        ),
    )

    def __repr__(self):
        return "<WorkingFile %s>" % self.id
