Home | History | Annotate | Download | only in migrations
      1 UP_SQL = """
      2 ALTER TABLE tko_jobs
      3 ADD COLUMN (afe_parent_job_id INT default NULL,
      4             build varchar(255) default NULL,
      5             build_version varchar(255) default NULL,
      6             suite varchar(40) default NULL,
      7             board varchar(40) default NULL),
      8 ADD INDEX afe_parent_job_id (afe_parent_job_id),
      9 ADD INDEX build (build),
     10 ADD INDEX build_version_suite_board (build_version, suite, board);
     11 
     12 ALTER VIEW tko_test_view_2 AS
     13 SELECT  tko_tests.test_idx,
     14         tko_tests.job_idx,
     15         tko_tests.test AS test_name,
     16         tko_tests.subdir,
     17         tko_tests.kernel_idx,
     18         tko_tests.status AS status_idx,
     19         tko_tests.reason,
     20         tko_tests.machine_idx,
     21         tko_tests.invalid,
     22         tko_tests.invalidates_test_idx,
     23         tko_tests.started_time AS test_started_time,
     24         tko_tests.finished_time AS test_finished_time,
     25         tko_jobs.tag AS job_tag,
     26         tko_jobs.label AS job_name,
     27         tko_jobs.username AS job_owner,
     28         tko_jobs.queued_time AS job_queued_time,
     29         tko_jobs.started_time AS job_started_time,
     30         tko_jobs.finished_time AS job_finished_time,
     31         tko_jobs.afe_job_id AS afe_job_id,
     32         tko_jobs.afe_parent_job_id AS afe_parent_job_id,
     33         tko_jobs.build as build,
     34         tko_jobs.build_version as build_version,
     35         tko_jobs.suite as suite,
     36         tko_jobs.board as board,
     37         tko_machines.hostname AS hostname,
     38         tko_machines.machine_group AS platform,
     39         tko_machines.owner AS machine_owner,
     40         tko_kernels.kernel_hash,
     41         tko_kernels.base AS kernel_base,
     42         tko_kernels.printable AS kernel,
     43         tko_status.word AS status
     44 FROM tko_tests
     45 INNER JOIN tko_jobs ON tko_jobs.job_idx = tko_tests.job_idx
     46 INNER JOIN tko_machines ON tko_machines.machine_idx = tko_jobs.machine_idx
     47 INNER JOIN tko_kernels ON tko_kernels.kernel_idx = tko_tests.kernel_idx
     48 INNER JOIN tko_status ON tko_status.status_idx = tko_tests.status;
     49 """
     50 
     51 DOWN_SQL = """
     52 ALTER VIEW tko_test_view_2 AS
     53 SELECT  tko_tests.test_idx,
     54         tko_tests.job_idx,
     55         tko_tests.test AS test_name,
     56         tko_tests.subdir,
     57         tko_tests.kernel_idx,
     58         tko_tests.status AS status_idx,
     59         tko_tests.reason,
     60         tko_tests.machine_idx,
     61         tko_tests.invalid,
     62         tko_tests.invalidates_test_idx,
     63         tko_tests.started_time AS test_started_time,
     64         tko_tests.finished_time AS test_finished_time,
     65         tko_jobs.tag AS job_tag,
     66         tko_jobs.label AS job_name,
     67         tko_jobs.username AS job_owner,
     68         tko_jobs.queued_time AS job_queued_time,
     69         tko_jobs.started_time AS job_started_time,
     70         tko_jobs.finished_time AS job_finished_time,
     71         tko_jobs.afe_job_id AS afe_job_id,
     72         tko_machines.hostname AS hostname,
     73         tko_machines.machine_group AS platform,
     74         tko_machines.owner AS machine_owner,
     75         tko_kernels.kernel_hash,
     76         tko_kernels.base AS kernel_base,
     77         tko_kernels.printable AS kernel,
     78         tko_status.word AS status
     79 FROM tko_tests
     80 INNER JOIN tko_jobs ON tko_jobs.job_idx = tko_tests.job_idx
     81 INNER JOIN tko_machines ON tko_machines.machine_idx = tko_jobs.machine_idx
     82 INNER JOIN tko_kernels ON tko_kernels.kernel_idx = tko_tests.kernel_idx
     83 INNER JOIN tko_status ON tko_status.status_idx = tko_tests.status;
     84 
     85 ALTER TABLE tko_jobs
     86 DROP INDEX afe_parent_job_id,
     87 DROP INDEX build,
     88 DROP INDEX build_version_suite_board,
     89 DROP COLUMN afe_parent_job_id,
     90 DROP COLUMN build,
     91 DROP COLUMN build_version,
     92 DROP COLUMN suite,
     93 DROP COLUMN board;
     94 """
     95