1UP_SQL = """ 2ALTER TABLE tko_jobs 3ADD 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), 8ADD INDEX afe_parent_job_id (afe_parent_job_id), 9ADD INDEX build (build), 10ADD INDEX build_version_suite_board (build_version, suite, board); 11 12ALTER VIEW tko_test_view_2 AS 13SELECT 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 44FROM tko_tests 45INNER JOIN tko_jobs ON tko_jobs.job_idx = tko_tests.job_idx 46INNER JOIN tko_machines ON tko_machines.machine_idx = tko_jobs.machine_idx 47INNER JOIN tko_kernels ON tko_kernels.kernel_idx = tko_tests.kernel_idx 48INNER JOIN tko_status ON tko_status.status_idx = tko_tests.status; 49""" 50 51DOWN_SQL = """ 52ALTER VIEW tko_test_view_2 AS 53SELECT 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 79FROM tko_tests 80INNER JOIN tko_jobs ON tko_jobs.job_idx = tko_tests.job_idx 81INNER JOIN tko_machines ON tko_machines.machine_idx = tko_jobs.machine_idx 82INNER JOIN tko_kernels ON tko_kernels.kernel_idx = tko_tests.kernel_idx 83INNER JOIN tko_status ON tko_status.status_idx = tko_tests.status; 84 85ALTER TABLE tko_jobs 86DROP INDEX afe_parent_job_id, 87DROP INDEX build, 88DROP INDEX build_version_suite_board, 89DROP COLUMN afe_parent_job_id, 90DROP COLUMN build, 91DROP COLUMN build_version, 92DROP COLUMN suite, 93DROP COLUMN board; 94""" 95