Web frontend database: Expand test and subdir fields from tko_tests v2

Tests with large tags, such as the ones that can appear on the kvm test
can have the fields 'test' and 'subdir' too large. This patch raises
the length of such fields on the autotest_web database to 300.

Changes from v1:

 * Realized that tko/migrations/019_widen_test_name_field.py expands the
original value that test has from 30 to 60, so changed the downgrade
sql statement accordingly.

Signed-off-by: Lucas Meneghel Rodrigues <lmr@redhat.com>


git-svn-id: http://test.kernel.org/svn/autotest/trunk@4360 592f7852-d20e-0410-864c-8624ca9c26a4
diff --git a/frontend/migrations/052_expand_test_subdir_fields.py b/frontend/migrations/052_expand_test_subdir_fields.py
new file mode 100644
index 0000000..f72ca60
--- /dev/null
+++ b/frontend/migrations/052_expand_test_subdir_fields.py
@@ -0,0 +1,9 @@
+UP_SQL = """
+ALTER TABLE tko_tests MODIFY test varchar(300) default NULL;
+ALTER TABLE tko_tests MODIFY subdir varchar(300) default NULL;
+"""
+
+DOWN_SQL = """
+ALTER TABLE tko_tests MODIFY test varchar(60) default NULL;
+ALTER TABLE tko_tests MODIFY subdir varchar(60) default NULL;
+"""
diff --git a/frontend/tko/models.py b/frontend/tko/models.py
index ca7e4b1..9c68777 100644
--- a/frontend/tko/models.py
+++ b/frontend/tko/models.py
@@ -171,8 +171,8 @@
            model_logic.ModelWithAttributes):
     test_idx = dbmodels.AutoField(primary_key=True)
     job = dbmodels.ForeignKey(Job, db_column='job_idx')
-    test = dbmodels.CharField(max_length=90)
-    subdir = dbmodels.CharField(blank=True, max_length=180)
+    test = dbmodels.CharField(max_length=300)
+    subdir = dbmodels.CharField(blank=True, max_length=300)
     kernel = dbmodels.ForeignKey(Kernel, db_column='kernel_idx')
     status = dbmodels.ForeignKey(Status, db_column='status')
     reason = dbmodels.CharField(blank=True, max_length=3072)
@@ -341,8 +341,8 @@
                 TestLabel.objects.filter(name__in=label_names)
                 .values_list('name', 'id'))
         if len(label_ids) < len(set(label_names)):
-                raise ValueError('Not all labels found: %s' %
-                                 ', '.join(label_names))
+            raise ValueError('Not all labels found: %s' %
+                             ', '.join(label_names))
         return dict(name_and_id for name_and_id in label_ids)