From 7a1033e4af9bdca1654f9faef506f719259fc085 Mon Sep 17 00:00:00 2001
From: Martijn Vermaat <martijn@vermaat.name>
Date: Mon, 9 Nov 2015 17:24:47 +0100
Subject: [PATCH] Drop BatchJob.download_url column

This is now created on use, by #111.

Fixes #112
---
 ...1ed411f9fdfa_drop_batchjob_download_url.py | 30 +++++++++++++++++++
 mutalyzer/db/models.py                        |  8 +----
 2 files changed, 31 insertions(+), 7 deletions(-)
 create mode 100644 migrations/versions/1ed411f9fdfa_drop_batchjob_download_url.py

diff --git a/migrations/versions/1ed411f9fdfa_drop_batchjob_download_url.py b/migrations/versions/1ed411f9fdfa_drop_batchjob_download_url.py
new file mode 100644
index 00000000..4856f6ab
--- /dev/null
+++ b/migrations/versions/1ed411f9fdfa_drop_batchjob_download_url.py
@@ -0,0 +1,30 @@
+"""Drop BatchJob.download_url
+
+Revision ID: 1ed411f9fdfa
+Revises: 10692e9f4836
+Create Date: 2015-11-09 17:24:15.630818
+
+"""
+
+from __future__ import unicode_literals
+
+# revision identifiers, used by Alembic.
+revision = '1ed411f9fdfa'
+down_revision = u'10692e9f4836'
+
+from alembic import op
+import sqlalchemy as sa
+
+
+def upgrade():
+    ### commands auto generated by Alembic - please adjust! ###
+    with op.batch_alter_table('batch_jobs') as batch_op:
+        batch_op.drop_column('download_url')
+    ### end Alembic commands ###
+
+
+def downgrade():
+    ### commands auto generated by Alembic - please adjust! ###
+    with op.batch_alter_table('batch_jobs') as batch_op:
+        batch_op.add_column(sa.Column('download_url', sa.VARCHAR(length=200), autoincrement=False, nullable=True))
+    ### end Alembic commands ###
diff --git a/mutalyzer/db/models.py b/mutalyzer/db/models.py
index 90a94e19..03e6bf5b 100644
--- a/mutalyzer/db/models.py
+++ b/mutalyzer/db/models.py
@@ -76,10 +76,6 @@ class BatchJob(db.Base):
     #: Email address of user who submitted the job.
     email = Column(String(200))
 
-    #: URL for downloading the job result file. This would usually be a view
-    #: on the Mutalyzer website.
-    download_url = Column(String(200))
-
     #: Type of batch job.
     job_type = Column(Enum(*BATCH_JOB_TYPES, name='job_type'), nullable=False)
 
@@ -95,11 +91,9 @@ class BatchJob(db.Base):
     #: Date and time of creation.
     added = Column(DateTime)
 
-    def __init__(self, job_type, email=None, download_url=None,
-                 argument=None):
+    def __init__(self, job_type, email=None, argument=None):
         self.job_type = job_type
         self.email = email
-        self.download_url = download_url
         self.argument = argument
         self.result_id = unicode(uuid.uuid4())
         self.added = datetime.now()
-- 
GitLab