1 UP_SQL = """ 2 CREATE VIEW test_view_2 AS 3 SELECT tests.test_idx, 4 tests.job_idx, 5 tests.test AS test_name, 6 tests.subdir, 7 tests.kernel_idx, 8 tests.status AS status_idx, 9 tests.reason, 10 tests.machine_idx, 11 tests.started_time AS test_started_time, 12 tests.finished_time AS test_finished_time, 13 jobs.tag AS job_tag, 14 jobs.label AS job_name, 15 jobs.username AS job_owner, 16 jobs.queued_time AS job_queued_time, 17 jobs.started_time AS job_started_time, 18 jobs.finished_time AS job_finished_time, 19 machines.hostname AS hostname, 20 machines.machine_group AS platform, 21 machines.owner AS machine_owner, 22 kernels.kernel_hash, 23 kernels.base AS kernel_base, 24 kernels.printable AS kernel, 25 status.word AS status 26 FROM tests 27 INNER JOIN jobs ON jobs.job_idx = tests.job_idx 28 INNER JOIN machines ON machines.machine_idx = jobs.machine_idx 29 INNER JOIN kernels ON kernels.kernel_idx = tests.kernel_idx 30 INNER JOIN status ON status.status_idx = tests.status; 31 """ 32 33 def migrate_up(manager): 34 manager.execute(UP_SQL) 35 36 37 def migrate_down(manager): 38 manager.execute('DROP VIEW IF EXISTS test_view_2') 39