import enum
from sqlalchemy import Column, Integer, String, Enum

from virtool.pg.utils import Base, SQLEnum


class IndexType(str, SQLEnum):
    """
    Enumerated type for index file types

    """

    json = "json"
    fasta = "fasta"
    bowtie2 = "bowtie2"


class IndexFile(Base):
    """
    SQL model to store new index files

    """
    __tablename__ = "index_files"

    id = Column(Integer, primary_key=True)
    name = Column(String)
    reference = Column(String)
    type = Column(Enum(IndexType))
    size = Column(Integer)

    def __repr__(self):
        return f"<IndexFile(id={self.id}, name={self.name}, reference={self.reference}, type={self.type}, " \
               f"size={self.size} "

import enum
from sqlalchemy import Column, Integer, String, Enum

from virtool.pg.utils import Base, SQLEnum


class IndexType(str, SQLEnum):
    """
    Enumerated type for index file types

    """

    json = "json"
    fasta = "fasta"
    bowtie2 = "bowtie2"


class IndexFile(Base):
    """
    SQL model to store new index files

    """
    __tablename__ = "index_files"

    id = Column(Integer, primary_key=True)
    name = Column(String)
    index = Column(String)
    type = Column(Enum(IndexType))
    size = Column(Integer)

    def __repr__(self):
        return f"<IndexFile(id={self.id}, name={self.name}, index={self.index}, type={self.type}, " \
               f"size={self.size} "

Update IndexFile model to have 'index' column instead of 'reference'
Update IndexFile model to have 'index' column instead of 'reference'

  import enum
  from sqlalchemy import Column, Integer, String, Enum
  
  from virtool.pg.utils import Base, SQLEnum
  
  
  class IndexType(str, SQLEnum):
      """
      Enumerated type for index file types
  
      """
  
      json = "json"
      fasta = "fasta"
      bowtie2 = "bowtie2"
  
  
  class IndexFile(Base):
      """
      SQL model to store new index files
  
      """
      __tablename__ = "index_files"
  
      id = Column(Integer, primary_key=True)
      name = Column(String)
-     reference = Column(String)
+     index = Column(String)
      type = Column(Enum(IndexType))
      size = Column(Integer)
  
      def __repr__(self):
-         return f"<IndexFile(id={self.id}, name={self.name}, reference={self.reference}, type={self.type}, " \
+         return f"<IndexFile(id={self.id}, name={self.name}, index={self.index}, type={self.type}, " \
                 f"size={self.size} "
  
Update IndexFile model to have 'index' column instead of 'reference'
## Code Before:
import enum
from sqlalchemy import Column, Integer, String, Enum

from virtool.pg.utils import Base, SQLEnum


class IndexType(str, SQLEnum):
    """
    Enumerated type for index file types

    """

    json = "json"
    fasta = "fasta"
    bowtie2 = "bowtie2"


class IndexFile(Base):
    """
    SQL model to store new index files

    """
    __tablename__ = "index_files"

    id = Column(Integer, primary_key=True)
    name = Column(String)
    reference = Column(String)
    type = Column(Enum(IndexType))
    size = Column(Integer)

    def __repr__(self):
        return f"<IndexFile(id={self.id}, name={self.name}, reference={self.reference}, type={self.type}, " \
               f"size={self.size} "

## Instruction:
Update IndexFile model to have 'index' column instead of 'reference'
## Code After:
import enum
from sqlalchemy import Column, Integer, String, Enum

from virtool.pg.utils import Base, SQLEnum


class IndexType(str, SQLEnum):
    """
    Enumerated type for index file types

    """

    json = "json"
    fasta = "fasta"
    bowtie2 = "bowtie2"


class IndexFile(Base):
    """
    SQL model to store new index files

    """
    __tablename__ = "index_files"

    id = Column(Integer, primary_key=True)
    name = Column(String)
    index = Column(String)
    type = Column(Enum(IndexType))
    size = Column(Integer)

    def __repr__(self):
        return f"<IndexFile(id={self.id}, name={self.name}, index={self.index}, type={self.type}, " \
               f"size={self.size} "
