This commit is contained in:
Hannes Verschore 2015-10-27 15:59:35 +01:00
Родитель 7c97f22559
Коммит 4e657a3007
6 изменённых файлов: 29 добавлений и 27 удалений

Просмотреть файл

@ -1,11 +0,0 @@
<?php
// Demote 'stamp' to a number that will be sequential to base off the sorting.
$migrate = function() {
mysql_query("ALTER TABLE `awfy_run` CHANGE `stamp` `sort_order` INT( 10 ) UNSIGNED NOT NULL ;") or die(mysql_error());
};
$rollback = function() {
mysql_query("ALTER TABLE `awfy_run` CHANGE `sort_order` `stamp` INT( 10 ) UNSIGNED NOT NULL ;") or die(mysql_error());
};

Просмотреть файл

@ -3,15 +3,9 @@
// Demote 'stamp' to a number that will be sequential to base off the sorting.
$migrate = function() {
$query = mysql_query("SELECT distinct(machine) as machine FROM awfy_run") or die(mysql_error());
while($run = mysql_fetch_object($query)) {
mysql_query("SET @pos := 0;")or die (mysql_error());
mysql_query("UPDATE awfy_run
SET sort_order = ( SELECT @pos := @pos + 1 )
WHERE machine = ".$run->machine." ORDER BY sort_order ASC;") or die(mysql_error());
}
mysql_query("ALTER TABLE `awfy_run` CHANGE `stamp` `approx_stamp` INT( 10 ) UNSIGNED NOT NULL ;") or die(mysql_error());
};
$rollback = function() {
// Impossible to undo.
mysql_query("ALTER TABLE `awfy_run` CHANGE `approx_stamp` `stamp` INT( 10 ) UNSIGNED NOT NULL ;") or die(mysql_error());
};

Просмотреть файл

@ -1,12 +1,19 @@
<?php
// Add field 'outoforder' to the awfy_run database. In that case the finish_date shouldn't be used
// to know where on the graph to show this datapoint.
// Demote 'stamp' to a number that will be sequential to base off the sorting.
$migrate = function() {
mysql_query("ALTER TABLE `awfy_run` ADD `out_of_order` BOOLEAN NOT NULL;") or die(mysql_error());
mysql_query("ALTER TABLE `awfy_run` ADD `sort_order` INT ( 10 ) UNSIGNED NOT NULL;") or die(mysql_error());
$query = mysql_query("SELECT distinct(machine) as machine FROM awfy_run") or die(mysql_error());
while($run = mysql_fetch_object($query)) {
mysql_query("SET @pos := 0;")or die (mysql_error());
mysql_query("UPDATE awfy_run
SET sort_order = ( SELECT @pos := @pos + 1 )
WHERE machine = ".$run->machine." ORDER BY stamp ASC;") or die(mysql_error());
}
};
$rollback = function() {
mysql_query("ALTER TABLE `awfy_run` DROP `out_of_order`;") or die(mysql_error());
mysql_query("ALTER TABLE `awfy_run` DROP `sort_order`;") or die(mysql_error());
};

12
database/migration-4.php Normal file
Просмотреть файл

@ -0,0 +1,12 @@
<?php
// Add field 'outoforder' to the awfy_run database. In that case the finish_date shouldn't be used
// to know where on the graph to show this datapoint.
$migrate = function() {
mysql_query("ALTER TABLE `awfy_run` ADD `out_of_order` BOOLEAN NOT NULL;") or die(mysql_error());
};
$rollback = function() {
mysql_query("ALTER TABLE `awfy_run` DROP `out_of_order`;") or die(mysql_error());
};

Просмотреть файл

@ -51,7 +51,7 @@ def fetch_test_scores(machine_id, suite_id, name,
for row in c.fetchall():
suite_ids.append(str(row[0]))
query = "SELECT STRAIGHT_JOIN r.id, r.finish_stamp, b.cset, s.score, b.mode_id, v.id, s.id \
query = "SELECT STRAIGHT_JOIN r.id, r.approx_stamp, b.cset, s.score, b.mode_id, v.id, s.id \
FROM awfy_run r \
JOIN awfy_build b ON r.id = b.run_id \
JOIN awfy_score s1 ON s1.build_id = b.id \
@ -71,7 +71,7 @@ def fetch_test_scores(machine_id, suite_id, name,
def fetch_suite_scores(machine_id, suite_id,
finish_stamp = (0, "UNIX_TIMESTAMP()")):
query = "SELECT STRAIGHT_JOIN r.id, r.finish_stamp, b.cset, s.score, b.mode_id, v.id, s.id \
query = "SELECT STRAIGHT_JOIN r.id, r.approx_stamp, b.cset, s.score, b.mode_id, v.id, s.id \
FROM awfy_run r \
JOIN awfy_build b ON r.id = b.run_id \
JOIN awfy_score s ON s.build_id = b.id \

Просмотреть файл

@ -20,9 +20,9 @@ if (isset($_GET['run']) && $_GET['run'] == 'yes') {
WHERE machine = '".$MACHINE."'") or die(mysql_error());
$run = mysql_fetch_object($query);
mysql_query("INSERT INTO awfy_run (machine, sort_order)
mysql_query("INSERT INTO awfy_run (machine, sort_order, approx_stamp)
VALUES
($MACHINE, {$run->maximum})")
($MACHINE, {$run->maximum}, UNIX_TIMESTAMP())")
or die("ERROR: " . mysql_error());
print("id=" . mysql_insert_id());
die();