diff --git a/migrations/versions/10692e9f4836_drop_transcriptproteinlink_table.py b/migrations/versions/10692e9f4836_drop_transcriptproteinlink_table.py new file mode 100644 index 0000000000000000000000000000000000000000..c32a415205145cc145620ccc11dad61720b61698 --- /dev/null +++ b/migrations/versions/10692e9f4836_drop_transcriptproteinlink_table.py @@ -0,0 +1,34 @@ +"""Drop TranscriptProteinLink table + +Revision ID: 10692e9f4836 +Revises: 1bf1b52f057 +Create Date: 2015-11-09 16:11:50.425722 + +""" + +from __future__ import unicode_literals + +# revision identifiers, used by Alembic. +revision = '10692e9f4836' +down_revision = u'1bf1b52f057' + +from alembic import op +import sqlalchemy as sa +from sqlalchemy.dialects import postgresql + +def upgrade(): + ### commands auto generated by Alembic - please adjust! ### + op.drop_table('transcript_protein_links') + ### end Alembic commands ### + + +def downgrade(): + ### commands auto generated by Alembic - please adjust! ### + op.create_table('transcript_protein_links', + sa.Column('id', sa.INTEGER(), nullable=False), + sa.Column('transcript_accession', sa.VARCHAR(length=20), autoincrement=False, nullable=True), + sa.Column('protein_accession', sa.VARCHAR(length=20), autoincrement=False, nullable=True), + sa.Column('added', postgresql.TIMESTAMP(), autoincrement=False, nullable=True), + sa.PrimaryKeyConstraint('id', name=u'transcript_protein_links_pkey') + ) + ### end Alembic commands ### diff --git a/mutalyzer/db/models.py b/mutalyzer/db/models.py index 17d34186fd95e9981a56d5012f610f37e073c9e9..90a94e19ad8717c085d3dfd4f598e6917fc9933c 100644 --- a/mutalyzer/db/models.py +++ b/mutalyzer/db/models.py @@ -214,43 +214,6 @@ Index('reference_slice', unique=True) -# Todo: Perhaps it is a better fit to implement this with Redis. -class TranscriptProteinLink(db.Base): - """ - Cached link between a transcript and protein reference. - """ - __tablename__ = 'transcript_protein_links' - __table_args__ = {'mysql_engine': 'InnoDB', 'mysql_charset': 'utf8'} - - id = Column(Integer, primary_key=True) - - #: Accession number for the transcript, not including the version number - #: (e.g., ``NM_018195`, ``XM_005270562``, ``NR_015380``). If `NULL`, the - #: record states that no transcript is linked to the protein. - transcript_accession = Column(String(20), nullable=True, index=True, - unique=True) - - #: Accession number for the protein, not including the version number - #: (e.g., ``NP_060665``, ``XP_005258635``). If `NULL`, the record states - #: that no protein is linked to the transcript. - protein_accession = Column(String(20), nullable=True, index=True, - unique=True) - - #: Date and time of creation. - added = Column(DateTime) - - def __init__(self, transcript_accession=None, protein_accession=None): - if transcript_accession is None and protein_accession is None: - raise ValueError('Link must have a transcript or protein') - self.transcript_accession = transcript_accession - self.protein_accession = protein_accession - self.added = datetime.now() - - def __repr__(self): - return '<TranscriptProteinLink transcript=%r protein=%r>' \ - % (self.transcript_accession, self.protein_accession) - - class Assembly(db.Base): """ Genome assembly.