1def migrate_up(manager): 2 manager.execute(ALTER_VIEWS_UP_SQL) 3 4 5def migrate_down(manager): 6 manager.execute(ALTER_VIEWS_DOWN_SQL) 7 8 9ALTER_VIEWS_UP_SQL = """\ 10ALTER VIEW perf_view AS 11SELECT tests.test_idx, 12 tests.job_idx, 13 tests.test, 14 tests.subdir, 15 tests.kernel_idx, 16 tests.status, 17 tests.reason, 18 tests.machine_idx, 19 tests.started_time AS test_started_time, 20 tests.finished_time AS test_finished_time, 21 jobs.tag AS job_tag, 22 jobs.label AS job_label, 23 jobs.username AS job_username, 24 jobs.queued_time AS job_queued_time, 25 jobs.started_time AS job_started_time, 26 jobs.finished_time AS job_finished_time, 27 machines.hostname AS machine_hostname, 28 machines.machine_group, 29 machines.owner AS machine_owner, 30 kernels.kernel_hash, 31 kernels.base AS kernel_base, 32 kernels.printable AS kernel_printable, 33 status.word AS status_word, 34 iteration_result.iteration, 35 iteration_result.attribute AS iteration_key, 36 iteration_result.value AS iteration_value 37FROM tests 38INNER JOIN jobs ON jobs.job_idx = tests.job_idx 39INNER JOIN machines ON machines.machine_idx = jobs.machine_idx 40INNER JOIN kernels ON kernels.kernel_idx = tests.kernel_idx 41INNER JOIN status ON status.status_idx = tests.status 42INNER JOIN iteration_result ON iteration_result.test_idx = tests.test_idx; 43""" 44 45ALTER_VIEWS_DOWN_SQL = """\ 46ALTER VIEW perf_view AS 47SELECT tests.test_idx, 48 tests.job_idx, 49 tests.test, 50 tests.subdir, 51 tests.kernel_idx, 52 tests.status, 53 tests.reason, 54 tests.machine_idx, 55 tests.started_time AS test_started_time, 56 tests.finished_time AS test_finished_time, 57 jobs.tag AS job_tag, 58 jobs.label AS job_label, 59 jobs.username AS job_username, 60 jobs.queued_time AS job_queued_time, 61 jobs.started_time AS job_started_time, 62 jobs.finished_time AS job_finished_time, 63 machines.hostname AS machine_hostname, 64 machines.machine_group, 65 machines.owner AS machine_owner, 66 kernels.kernel_hash, 67 kernels.base AS kernel_base, 68 kernels.printable AS kernel_printable, 69 status.word AS status_word, 70 iteration_result.iteration, 71 iteration_result.attribute AS iteration_key, 72 iteration_result.value AS iteration_value 73FROM tests 74INNER JOIN jobs ON jobs.job_idx = tests.job_idx 75INNER JOIN machines ON machines.machine_idx = jobs.machine_idx 76INNER JOIN kernels ON kernels.kernel_idx = tests.kernel_idx 77INNER JOIN status ON status.status_idx = tests.status 78INNER JOIN iteration_result ON iteration_result.test_idx = tests.kernel_idx; 79""" 80